java - No appenders could be found for logger using Log4j -


enter image description herei'm running application locally , trying output logs file created. log4j.properties file looks this:

# define root logger appender file  log4j.rootlogger = debug, file  # define file appender log4j.appender.file=org.apache.log4j.fileappender log4j.appender.file.file=c:\\users\\jkm144\\workspace\\ldappurge\\log.out  # define layout file appender log4j.appender.file.layout=org.apache.log4j.patternlayout log4j.appender.file.layout.conversionpattern=%m%n 

it's maven project. it's defined in pom.xml , listed in maven dependencies.

i've imported 3 classes:

import org.apache.log4j.level; import org.apache.log4j.logger; import org.apache.log4j.fileappender; 

and code i'm using define logger is:

static logger log = logger.getlogger(ldappurge.class.getname()); 

any time run log, tells me "log4j:warn no appenders found logger"

i'm not sure i'm doing wrong. first time using log4j.

your screenshot suggests maven project, put log4j.properties in src/main/resources. maven-standard path resource files need end on classpath @ runtime, , put in there packaged application's jar file along classes compiled sources in src/main/java.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -