IBM i - Clear all Code Tracing entries


This article is now available in our new Knowledge Base: IBM i - Clear all Code Tracing entries


The Code Tracing monitor displays so many pages of Code Traces that it is difficult to delete them all in the GUI.  The customer would like to just remove them all and start over.


This article applies to the IBM i versions of Zend Server 6 and Zend Server 7.  The file paths mentioned are unique to the IBM i versions. 


If Code Tracing is enabled for one or more very common events, then code trace dumps can accumulate very quickly, and reach unmanageable levels.  Code Tracing is meant to be a diagnostic tool, and in general should not be routinely enabled for events in a production environment.  Instead, Code Tracing should be enabled for an event type that is under active investigation, and should be disabled when the investigation is concluded.  The following steps can help you clear the code trace dumps and data base if too many accumulate for manual deletion.

Note: This procedure requires a restart of Zend Server, so your web site will be down for a few minutes.  Please schedule this activity for a time when the service disruption will have the minimum impact.

1.  (Optional) Consider disabling Code Tracing for Monitor Events, to prevent proliferation of excess Code Trace dumps.  This setting can be used later to turn Code Tracing On and Off only as needed to research issues.   In the Zend Server Administrative interface,please go to the Configurations -> Monitor tab.  Under the heading "Code Tracing Settings", select the "Disable Code Tracing" button.  Click the "Save" button to save the change.  Do not restart the PHP server at this time, it will be done in a later step.

2.  Using Navigator, the RSE view in Zend Studio, a mapped network drive, a graphical FTP client like FileZilla, or any other utility you may have, navigate to this folder in the IFS:


Delete all of the files in the directory.  You can use the wrklnk command to do this task, but there may be thousands of files to page through, so a tool with a graphical interface is probably much easier.  It can take a lot of time to delete many thousands of files from the IFS, so you can do most of this ahead of time during the day, then finish up any late additions just prior to the restart of Zend Server.

3.  Next, please navigate to this folder (it should be right next to the previous folder):


Delete file codetracing.db.

Delete file monitor_codetracing

4.  Stop and Restart Zend Server.  From the 5250 command line:

go zendsvr6/zsvmenu

Use option "2. Stop Zend Server Subsystem".  Then, on the command line below the menu:

wrkactjob sbs(zendsvr6)

Verify there are no active jobs in the subsystem. If any jobs remain, use F5 a few times until they are all gone.  If any jobs persist for more than a few minutes, end them manually.  Then, F3 back to the command line and:

wrkactjob sbs(qhttpsvr)

Verify there are no jobs named ZENDSVR6 in this subsystem.  There can be other jobs and those other jobs should be left alone.  As before, use F5 until all the ZENDSVR6 jobs are gone, and feel free to end them manually if it seems you are waiting to long.  Then use F3 to return, which should bring you back to the menu.

Use option "1. Start Zend Server Subsystem".  This will start up Zend Server.  Give it a couple of minutes for all of the Apache jobs to start, then return to the Zend Server Admin in your browser and verify that there are no Code Traces showing on the Overview -> Code Tracing tab.