Error No Layout Set For The Appender Named Localhost
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 Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation 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 only takes a minute: Sign up Log4J out to console and file produces warnings/errors log4j:WARN File option not set for appender up vote 1 down vote favorite I'd like to integrate Log4J logging into my Java application, writing information out to a log file as well as displaying the info at the console. Unfortunately, I've had some trouble getting this off the ground. I'm working with Eclipse Juno on Win 7. My log4j.properties file: #configure logfile log4j.appender.logfile = org.apache.log4j.RollingFileAppender log4j.appedner.logfile.File = MyAppLog.log log4j.appender.logfile.Append = true log4j.appender.logfile.layout = org.apache.log4j.PatternLayout log4j.appender.logfile.layout.ConversionPattern = %-5p %d [%t][%F:%L] : %m%n #configure stdout log4j.appender.stdout = org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target = System.out log4j.appender.stdout.layout = org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern = %-5p %d [%t][%F:%L] : %m%n log4j.rootLogger=debug, logfile, stdout I belive the above follows the pattern of some other accepted answers on this topic. I've specifed the location of this log4j.properties file wtih a VM argument: -Dlog4j.configuration=file:///${workspace_loc}\path\to\file\log4j.properties I instantiate the logger in my java class: static Logger logger = Logger.getLogger(MyApp.class.getName()); log a string: logger.info("barfoo"); This configuration results in the following warnings/errors on launch: log4j:WARN File option not set for appender [logfile]. log4j:WARN Are you using FileAppender instead of ConsoleAppender? log4j:ERROR No output stream or file set for the appender named [logfile] It does not produce the log file. The console logging seems to be working just fine, however. java eclipse log4j share|improve this question edited Aug 12 '13 at 23:13 asked Aug 12 '13 at 21:44 caffreydave 7839 add a comment| 1 Answer 1 active oldest votes up vote 6 down vote accepted This will sound stupid - you have a typo. You have log4j.appedner.logfile.File instead of log4j.appender.logfile.File (note the 'n' and 'd' are switched). This is why it's complaining that you
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 Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation 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 only takes a minute: Sign up What are the http://stackoverflow.com/questions/18197187/log4j-out-to-console-and-file-produces-warnings-errors-log4jwarn-file-option-no possible reasons behind “log4j: Error Could not find value for key log4j.appender.SQL_APPENDER” up vote 5 down vote favorite I am wondering why I have this error when deploying my web application. log4j: Error Could not find value for key log4j.appender.SQL_APPENDER Here is my log4j.properties file. log4j.rootLogger=error, stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.layout=org.apache.log4j.PatternLayout # Print the date in ISO 8601 format log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n log4j.appender.R=org.apache.log4j.RollingFileAppender log4j.appender.R.File=application.log http://stackoverflow.com/questions/11898663/what-are-the-possible-reasons-behind-log4j-error-could-not-find-value-for-key log4j.appender.R.MaxFileSize=100KB # Keep one backup file log4j.appender.R.MaxBackupIndex=1 log4j.appender.R.layout=org.apache.log4j.PatternLayout log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n log4j.logger.org.hibernate.SQL=DEBUG, SQL_APPENDER log4j.additivity.org.hibernate.SQL=false Do I have to do some configuration in the server side? I am running my application on a Tomcat 7 server. I added this dependency to the pom.xml file:
here for a quick overview of the site http://stackoverflow.com/questions/32760493/error-could-not-find-value-for-key-log4j-appender-error-during-deploying-on-tomc Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users error no 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 only takes a minute: Sign up ERROR Could not find value for key log4j.appender.error during deploying on tomcat error no layout up vote 1 down vote favorite my code is working fine if i right click on server and run as run on server , but when i try to deploy it on tomcat and try to run it it is giving me below error log4j.properties file: log4j.logger.Controller = INFO,error,stdout log4j.logger.Client = INFO,error,stdout log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n error: log4j:ERROR Could not find value for key log4j.appender.error log4j:ERROR Could not instantiate appender named "error". log4j:ERROR Could not find value for key log4j.appender.error log4j:ERROR Could not instantiate appender named "error". log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info. pom.xml :