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 privates, 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

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -