java - How do I access a property from log4j.properties in a JUnit test? -
i'm writing unit test validate logging functionality checking log file. started log path hard coded in test case, i'd rather use entry log4j.appender.file.file
in log4j.properties
file, in case changes. there way access programmatically inside junit code?
and in case wondering: functionality i'm testing in private
s, can't check return values.
you can access programmatically using following:
fileappender appender = (fileappender) logmanager.getrootlogger().getappender("file"); file file = new file(appender.getfile());
Comments
Post a Comment