Can I override the File property of an application configured in log4j.properties without creating a new application? And if so - how?
This is the situation: I have two attributes, A1 is ConsoleAppender, and A2 is FileAppender. A2 "File" indicates a common error.log:
log4j.appender.A2.File=error.csv
This appender only logs error level events or worse through
log4j.appender.A2.Threshold=error .
Now I want these errors to be written to different files depending on which class caused the error, since there are several classes from which instances are created. Being able to see which class generated the error (s) quickly will be very useful, as it is much more useful, and then slips through error.log, which searches for class tags.
So my idea was to override the File property, for example. in the constructors of these newly created classes, so they log errors in different files.
Many thanks!
m00hk00h
source share