log4j : time in the file name

C

CABA

Hi,

I have a little problem with log4j.
I use a properties file for the log4j configuration with an Appender of type
FileAppender, with a HTMLLayout.

I would wish that the name of my files created in every session contains the
date and the hour of creation. I don't know how to make this directly in the
properties file :

log4j.appender.A_FILE.File=log.html

How to make thus to have a file like this :
log-YYYYMMDD-HHMMSS.html ???

Thanks,

CABA
 
A

Alex Hunsley

CABA said:
Hi,

I have a little problem with log4j.
I use a properties file for the log4j configuration with an Appender of type
FileAppender, with a HTMLLayout.

I would wish that the name of my files created in every session contains the
date and the hour of creation. I don't know how to make this directly in the
properties file :

log4j.appender.A_FILE.File=log.html

How to make thus to have a file like this :
log-YYYYMMDD-HHMMSS.html ???

Thanks,

CABA

The docs will tell you how. They are your friend.

http://logging.apache.org/log4j/docs/manual.html
 
C

CABA

Alex Hunsley said:
Good point. I had to find out from the API docs. The page you want is:

http://logging.apache.org/log4j/docs/api/org/apache/log4j/PatternLayout.html

can you please not top-post please? It makes threads confusing...

alex

Sorry for the top-post ;-)

I don't speak english very well so perhaps you don't understand exactly what
I want.
The PatternLayout allows to describe what is IN the log file.

But me, I would like to have a new file (with a file name which must contain
the current date and time) every time I launch my application.

Is it possible ???

Thanks

CABA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top