I need to write a log file for one functionality by using log4j2. In the same module already one log file is being written by using RollingFileAppender.
Both logs are different, and I need different logs file for each, but both are in the same package in Java. How can I do this?
For example, existing log file handles about developer log, now I want to make log file for request received.
This is the log4j2 xml for the existing log:
<RollingFile name="File" fileName="log/CRUD.log"
filePattern="log/CRUD.%d{yyyy-MM-dd}_%i.Logs.gz">
<Layout type="PatternLayout">
<Pattern>%d{[MM.dd.yyyy] | [HH:mm:ss]|}%level{FATAL=[FATAL],ERROR=[ERROR], WARN=[WARN], INFO=[INFO], DEBUG=[DEBUG], TRACE=[TRACE]}|[%X{sessionID}]|[%F]|[%M]|[%L]|%m%throwable%n</Pattern>
</Layout>
<Policies>
<SizeBasedTriggeringPolicy size="100 MB" />
</Policies>
<DefaultRolloverStrategy fileIndex="max" max="50">
</DefaultRolloverStrategy>
</RollingFile>
How do I make another log file in the same package?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…