cancel
Showing results for 
Search instead for 
Did you mean: 

application log in Java

Former Member
0 Kudos

Hello,

is there any way we can rename the application log in java located in /usr/sap/......./work directory? I would like to rename/create xyz.log file lets say everyweek...like xyz.log (week1)...xyz1.log(week2)...and so on. Is this possible or is there anyother solutions for this? please suggest.

thanks

Accepted Solutions (0)

Answers (2)

Answers (2)

nelis
Active Contributor
0 Kudos

See my post in your other thread for archiving of log files.

Nelis

Former Member
0 Kudos

Thanks Nelis for your input but I appologize that i am not very clear about your suggestions/link. I have this application log file located in /usr/sap/<SID>/JC01/work/xyz.log and current setup is that this log gets appended everyday. What i like to do is I want to create a new log file every 15days/Month like xyz1.log...xyz2.log.......and so on instead of appending in same log file everyday (which could be such a pain to dig through it). And eventually i would like to archive this also after 4 months or so. I looked up the options in SAP -Log configuration but couldnt find any solution that meet my requirement.

1) Can this be achived by doing by making some configuration changes in SAP? If so how?

2). if not, is there a way to do this using the script (AIX) ?

Any Suggestions/help will be greatly appreciated.

Thanks,

nelis
Active Contributor
0 Kudos

1) Can this be achived by doing by making some configuration changes in SAP? If so how?

In the link I provided there is an option to enable log archiving(for files in the default archive directory you mentioned) with Config Tool which will archive and zip logs when they reach 10MB in size and keep 5 files before overwriting the oldest log file. If this is not what you want then see below.

2). if not, is there a way to do this using the script (AIX) ?

AIX uses syslog as default for log rotation but it's probably better to write your own script.

You could always setup a cronjob that runs every 15 days and executes a script similar to the following:


#!/bin/sh
PATH=/usr/bin:/usr/sbin:/sbin:/usr/local/bin; export PATH
LOG="/usr/sap/<SID>/JC01/work/xyz.log"
DATE=`date +'%F'`

tar -czf filename$DATE.gz $LOG
cat /dev/null > $LOG
find /usr/sap/<SID>/JC01/work/filename.* -type f -mtime +120 |xargs rm -f

...which would compress the log file, empty it and delete any archives older than 4 months.

That is just an example, best to check with your AIX admin

Nelis

Former Member
0 Kudos

Hello,

Thanks for your replies. My plan is to create a custom view in NWA for this application.log. Currently i dohave a cutom view with filter "application name" where i provided my application's log name, this log sits here /usr/sap/<SID>/JC01/work/xyz.log. This is not working because it shows the logs from 9 months (since there is only one log which keeps appending everyday).

what is the best approach to archive this log every 1 month without moving the log location to other directory? but i want to keep this archived files to another location which can be retrieved later if needed. I understand the process for logs that resides in the directory where default_trace logs is located but i am not sure in my case how i can configure the same archiving process. Any help will be appreciated.

Thanks

sunny_pahuja2
Active Contributor
0 Kudos

Hi,

Yes, you can rename log files in work directory. You can proceed as per SAP note 16513.

Thanks

Sunny

Former Member
0 Kudos

Sunny,

Thanks for your reply. I dont just want to rename it manually . I want to automate this process to create new xyz.log files everyweek if this is possible. I am not sure if archiving would be the right choice for this and not sure if we can automate this by giving the time interval or not. please suggest.