Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

log4j.rootLogger=DEBUG,A1 identifier expected

Status
Not open for further replies.

swaroop

Programmer
Feb 4, 2001
100
0
0
US
import com.foo.Bar;

import org.apache.log4j.Logger;
import org.apache.log4j.PropertyConfigurator;

public class MyApp {

static Logger logger = Logger.getLogger(MyApp.class.getName());


log4j.rootLogger=DEBUG, A1
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout


log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n

log4j.logger.com.foo=WARN



public static void main(String[] args) {


// BasicConfigurator replaced with PropertyConfigurator.
PropertyConfigurator.configure(args[0]);

logger.info("Entering application.");
Bar bar = new Bar();
bar.doIt();
logger.info("Exiting application.");
}
}

 
Firstly, post code to this forum between [[]code][[]/code] tags. I don't want to have to struggle to read poorly formatted code.

It looks like you've simply dumped the log4j configuration information into the middle of your java class. The error I'm assuming you're getting refers to this 'illegal' java.

The lines starting with 'log4j.' need to go in a lo4j.properties file on the classpath.

If you don't know what a classpath is, then you need to read the FAQs on forum269.

Tim
 
hi,

I am sorry for posting code in unformated manner.I really don,t want to struggle u people,but this is the first time i am posting to forums.Anyway my problem has been solved.Thanks for u r reply.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top