A scenario:

Your application ABAP server has a problem and needs to be restarted ASAP. You restart the application but problem remains. You dig some more and find the source of the problem but need to restart the app again. After the second restart everything is ok and now it is time for the post-investigation.

You want to check the logs and traces in the WORK directory but there are no logs from the period prior to the first restart.

The reason is that the default behavior of the SAP application server is to rotate the logs and traces once after each restart without any retention of the current .old files.

I’ve looked all over for any profile parameter which controls the rotation behavior but couldn’t find any (if anyone knows about one – please keep me posted so i could stop using the following solution….)

So here is our workaround for keeping logs and traces as much as we need regardless the number of restarts  (Credit goes to my mentor Igal Serban):

We wrote a python script that creates a folder with the current date & time and copies all of the logs & traces from the WORK directory to that directory.

[In addition our script also contains the following rules: If the file is over 100mb it is not copied but renamed with “TOOBIG” as an extension (so it won’t prolong the startup), folders that are older than 2 weeks are deleted – unless there are less than three folders (it always keeps the last three).]

We’ve converted the py script to exe and added it as “Start_Program_00” in the application server’s start profile – so it will be the first thing that runs before the system starts.

The result:

We can restart the system as much as we need – and still have the logs and traces kept in their own folder.

Again,

If someone knows a better \ simpler way to keep the work directory content regardless to the number of restarts – i’d like to know.

If anyone wants the script i’d be happy to share it.

Enjoy 🙂

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

  1. Yves KERVADEC

    Hi,

    It seems that the script option is the only solution…

    112 – Trace and error information in the “dev_” files

    Trace files are overwritten when the instance is restarted. You must therefore save (copy) them before the restart, if you want to analyze them later on. As of Release 4.6, a backup copy with the extension .old is created at startup.

    There is a parameter “logfile/rotate=true”… but it is only for the log files (stdoutX , stderrX and  sapstartX.trc).

    768727 – Process automatic restart functions in sapstart

    Regards

    (0) 

Leave a Reply