java - "cannot find symbol" error for Log4J, even though I'm following the tutorial -


i'm getting following error:

1 error found: file: c:\users\adem\desktop\various_topics\javaprojects\log4jexample.java  [line: 15] error: cannot find symbol   symbol:   method getlogger(java.lang.string)   location: interface org.apache.logging.log4j.logger 

and here code, based off of tutorial:

import org.apache.logging.log4j.logmanager; import org.apache.logging.log4j.*;  public class log4jexample{    /* actual class name printed on */   static logger log = logger.getlogger(log4jexample.class.getname());   //.getname()   public static void main(string[] args)     throws ioexception,sqlexception{      log.debug("hello debug message");     log.info("hello info message");   } } 

thanks!

you need import:

import org.apache.log4j.logger; 

if you're using maven can use following dependency:

<dependency>    <groupid>log4j</groupid>    <artifactid>log4j</artifactid>    <version>1.2.15</version> </dependency> 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -