JBoss Community

log4j

created by Red Militante in Beginner's Corner - View the full discussion

I'm running into problems trying to add log4j logging to one of my classes.  This is part of an application deployed in JBoss as7 7.0.0-Final.

 

 

I add the following lines to my class

 

 

import org.apache.log4j.Logger;

 

 

public class Requests extends LEServlet

{

               private static final Logger logger = Logger.getLogger(Requests.class);

 

 

...

 

 

                       logger.info("data:" + ID + ":" + sessionLogID + ":" + queueID + ":" + uuid);

 

When I try to compile my code I get

 

 

[ERROR] /Users/red/Documents/hg/myappAnywhere-maven/src/main/java/com/mycompany/myapp/Requests.java:[27,23] package org.apache.log4j does not exist

[ERROR]

[ERROR] /Users/red/Documents/hg/myappAnywhere-maven/src/main/java/com/mycompany/myapp/Requests.java:[31,22] cannot find symbol

[ERROR] symbol  : class Logger

[ERROR] location: class com.mycompany.myapp.Requests

 

 

I have a log4j.properties in my src/main/resources/META-INF folder

 

 

log4j.rootLogger=WARN, A1

# Or log only errors, even less verbose

# log4j.rootLogger=ERROR, A1

log4j.appender.A1=org.apache.log4j.ConsoleAppender

log4j.appender.A1.layout=org.apache.log4j.PatternLayout

 

# Print the date in ISO 8601 format

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

 

 

and a log4j dependency in my MANIFEST.MF

 

 

Manifest-Version: 1.0

Dependencies: org.apache.log4j

 

 

Not sure why I'm getting these errors.  Any advice welcome.

Reply to this message by going to Community

Start a new discussion in Beginner's Corner at Community