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
Post a Comment