Cannot Find Symbol Error Symbol Class Logger
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About
Java: Package Org.apache.log4j Does Not Exist
Us Learn more about Stack Overflow the company Business Learn more about hiring package org.apache.log4j does not exist maven build developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the cannot find symbol log Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up “cannot find symbol” error for Log4J,
Org.apache.log4j.logger Maven
even though I'm following the tutorial up vote -1 down vote favorite I'm getting the 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 is my code, based off of this tutorial: import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.*; public class log4jExample{ /* Get actual class name to be printed on */ static Logger log = Logger.getLogger(log4jExample.class.getName()); //.getName()
Org.apache.log4j.logger Jar
public static void main(String[] args) throws IOException,SQLException{ log.debug("Hello this is an debug message"); log.info("Hello this is an info message"); } } thanks! java configuration log4j share|improve this question edited May 2 '13 at 23:15 asked May 2 '13 at 23:07 Coffee 5311962119 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote You need the import: import org.apache.log4j.Logger; If you're using Maven you can use the following dependency:
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings log4j getlogger and policies of this site About Us Learn more about Stack Overflow
Logger Error
the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation maven log4j Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it http://stackoverflow.com/questions/16349182/cannot-find-symbol-error-for-log4j-even-though-im-following-the-tutorial only takes a minute: Sign up How do I resolve this Log4J import error (relating to Classpath too)? up vote 4 down vote favorite 1 When I run the following simple log4J example, i get an error: import org.apache.logging.log4j.core.*; import java.io.*; import java.sql.SQLException; import java.util.*; public class log4jExample{ /* Get actual class name to be printed on */ static Logger log http://stackoverflow.com/questions/16270618/how-do-i-resolve-this-log4j-import-error-relating-to-classpath-too = Logger.getLogger( log4jExample.class.getName()); public static void main(String[] args) throws IOException,SQLException{ log.debug("Hello this is an debug message"); log.info("Hello this is an info message"); } } and the error reads: Error: package org.apache.logging.log4j.core does not exist Error: cannot find symbol symbol: class Logger location: class log4jExample File: C:\Users\adel\Desktop\various_topics\JavaProjects\log4jExample.java [line: 10] Error: cannot find symbol symbol: variable Logger location: class log4jExample So I believe I added log4J to the classpath correctly, as shown below: And I extracted the jar file log4j-core-2.0-beta4.jar from the apache directory as so: I'm not sure what's happening - how does the import statement work? i.e the example online tells me to say: import org.apache.log4j.Logger; but what if my directory structure is like this: \apache-log4j-2.0-beta4-bin\org\apache\logging\log4j\core\Logger.java Would I have to say: import org.apache.logging.log4j.core.Logger; instead? java configuration log4j log4j2 share|improve this question asked Apr 29 '13 at 3:02 Coffee 5311962119 add a comment| 2 Answers 2 active oldest votes up vote 8 down vote accepted I think you need both the API and the Core jars in your classpath. Follow these instructions for build and install and these for configuration
New Topic programming forums Java Java JSRs Mobile Certification Databases Caching Books Engineering Languages Frameworks Products This Site Careers Other all forums Forum: Beginning Java Cannot Find Symbol https://coderanch.com/t/492474/java/java/Find-Symbol-compile-decompiled-class when trying to compile decompiled class. Jeff Green Greenhorn Posts: 3 posted 6 years ago I have decompiled a class file and made a change to a hard-coded path. Now, I http://maven.40175.n5.nabble.com/Log4J-quot-cannot-find-symbol-method-trace-String-quot-td5792343.html want to recompile it but know nothing about JAVA. When I attempt to recompile I get several Cannot Find Symbol errors. Here are some of them... C:\JARFiles\EINSTR~1\dm\ui\SERIAL~1\StoredPreferencesManager.java:104: cannot find symbol symbol cannot find : class ElementList location: class einstruction.dm.ui.serialization.StoredPreferencesManager @ElementList ^ C:\JARFiles\EINSTR~1\dm\ui\SERIAL~1\StoredPreferencesManager.java:100: cannot find symbol symbol : variable einstruction location: class einstruction.dm.ui.serialization.StoredPreferencesManager private static final Logger logger = Logger.getLogger(einstruction/dm/ui/serialization/StoredPreferencesManager.getName()); ^ C:\JARFiles\EINSTR~1\dm\ui\SERIAL~1\StoredPreferencesManager.java:100: cannot find symbol symbol : variable dm location: class einstruction.dm.ui.serialization.StoredPreferencesManager private static final Logger logger = Logger.getLogger(einstruction/dm/ui/serialization/StoredPreferencesManager.getName()); ^ C:\JARFiles\EINSTR~1\dm\ui\SERIAL~1\StoredPreferencesManager.java:100: cannot find symbol symbol : variable ui location: class einstruction.dm.ui.serialization.StoredPreferencesManager private static final Logger logger = Logger.getLogger(einstruction/dm/ui/serialization/StoredPreferencesManager.getName()); cannot find symbol I'm sure there's something simple I'm just not including in the correct class path or something. Any help with this is greatly appreciated. I can give additional information if needed. Thanks! W. Joe Smith Ranch Hand Posts: 710 posted 6 years ago You could have missing entries on your classpath, but I want to ask another question...Why are you decompiling the class to make a change? Do you have access to the original .java file? SCJA When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was." Jeff Green Greenhorn Posts: 3 posted 6 years ago I work for a school system and theres some software we have and the developers used user.home to try to retrieve the user's home directory and apparently there's a known bug I've read about that hasn't been fixed yet having to do with this. I needed to change the path a file pointed to so it would fix our problem. Unfortunately, I do not have access to the original files. I do
Rychnovský Reply | Threaded Open this post in threaded view ♦ ♦ | Report Content as Inappropriate ♦ ♦ Log4J - "cannot find symbol - method trace(String)" Hi everyone, I have the following dependency in my project's POM: ...