logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From utc123 <kallurisuja...@yahoo.com>
Subject log4j Initialization problem
Date Sat, 13 Nov 2010 22:17:12 GMT

I have my own log4j logger names log4jlogger.java, defined the
log4j.properties and put them in classpath, it is java application (not the
web app) and developed with Netbeans and Tomcat, so the classes are under
build folder and found the properties file there. The configuration is fine
so the log properties are read well in log4jlogger class, but getting the
warning as
log4j:WARN No appenders could be found for logger
(com.hli.pt.sbnotifyBatch.util.Log4JLogger).
log4j:WARN Please initialize the log4j system properly.
code of log4jlogger:
try {
            fname ="none";
			if(fname.equalsIgnoreCase("none")) {
			    loggerProperties =
ConfigurationProperties.getInstance().getLoggerProperties();
			}else{
			    InputStream is = new FileInputStream(fname);
			    loggerProperties = new Properties();
			    loggerProperties.load(is);
			}
		    if (loggerProperties == null) {
				System.out.println(
					"***ANDON configuration problem***unable to obtain var
'loggerProperties' in method Log4JWrapper()");
				return;
			}
			if (logger == null) {
				logger = Logger.getLogger(getClass().getName());				/**
				 * PropertyConfigurator is an apache for dynamic configuration of Log4J
on an application level;
				 */
				PropertyConfigurator.configure(loggerProperties>);//loggerproperties has
the properties when I debug				addMsg("Datasource configured using: " +
ConfigurationProperties.getServer_Environment() + " server environment");
				addMsg("***ANDON Application Log4JWrapper - initialization
complete***");
				print();
			}


sbnotify.devl.log.properties
og4j.appender.ROOT.MaxBackupIndex=20
log4j.appender.ROOT.Append=true
#------------------------------------------------------------
# define your own logger
#log4j.logger.sbnotifybatch=com.utc.pw.sbnotifyBatch
#assign appender to your own logger
log4j.logger.com.hli.pt.sbnotifyBatch=ROOT
log4j.additivity.com.hli.pt.sbnotifyBatch=false
#------------------------------------------------------------
#Define Layout for appender named "ROOT"
log4j.appender.ROOT.layout=org.apache.log4j.PatternLayout
log4j.appender.ROOT.layout.ConversionPattern=%d{DATE} %5p - %m%n

I debugged the log4j and following are logs
log4j: Parsing for [root] with value=[ROOT].
log4j: Level token is [ROOT].
log4j: Category root set to DEBUG
log4j: Parsing for [com.hli.pt.sbnotifyBatch] with value=[ROOT].
log4j: Level token is [ROOT].
log4j: Category com.hli.pt.sbnotifyBatch set to DEBUG
log4j: Handling log4j.additivity.com.hli.pt.sbnotifyBatch=[false]
log4j: Setting additivity for "com.hli.pt.sbnotifyBatch" to false
log4j: Finished configuring.
log4j:WARN No appenders could be found for logger
(com.hli.pt.sbnotifyBatch.util.Log4JLogger).
log4j:WARN Please initialize the log4j system properly.

what are your suggestions to change and what could be the problem. the
configuration is fine as the log4jlogger.java is reading the properties ,
but not logging the messages.

-- 
View this message in context: http://old.nabble.com/log4j-Initialization-problem-tp30209729p30209729.html
Sent from the Log4j - Users mailing list archive at Nabble.com.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message