I’m a JAVA developer, In our applications we use Log4j logger.
For our log files we have 2 requirements:
1.The files are written in different folders according to hour change(every hour I open a new folder)
the index in the name file of those files should be sequential, that is,
after I open a new folder I want to start from index +1 of the last file in prev folder
my current pattern is:
<RollingRandomAccessFile name=”RollingFile” append=”true”
filename="${sys:logDir}/${sys:logAppName}_${sys:logSessionData}_LAST.logmx"
filePattern="${sys:logDir}/$${date:yyy-MM-dd-HH}/${sys:logAppName}_${sys:logSessionData}_#%i.logmx">
Currently the file name index (i) is being reset for each folder
2. The rolling of the files should goes from oldest file to newest between all folders
my current pattern is:
For example,
For 10 folders that contain together 10000 files,
the intention is that the oldest file (index 1) will be rolled over
Currently, the rolling is happening for current folder (newest folder)
Can someone give an idea how to define log4j.xml something else for create such logs files
and rolling.
Is it possible ? Can you give me an example?
Thank you
E.B
אחת111 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.