Creating a log file with current time

855 views Asked by At

I am trying to do something similar to Appending current time to a new log file each time log4j is initialized.
I am using log4c for logging. I would like to be able to create a new log file with each execution of the application. Is it possible to do this, by only modifying the log4crc config file. All help will be greatly appreciated

ps: The tag I wanted to used is log4c, but it isn't there in SO

2

There are 2 answers

0
bobby On BEST ANSWER

Doesn't seem to be possible via any config file. I had to modify the appender used to name the log file based on the current time. I used the functions time(), localtime() and strftime() to create the file name

0
Student On

I had a similar problem. It is now fixed in the current release, but Ubuntu for example still ships an older version without this facility.

See How to change log4c's default timezone?