-
1. Re: Log4j setting when using JBoss as 7.1.1.Final
jamezp Aug 22, 2012 11:23 AM (in response to hantsy)Can you paste an example of the log? My guess would be your seeing the stdout wrapped in an INFO messages. My guess is you're seeing something like the following.
08:21:01,648 INFO [stdout] (http-localhost-127.0.0.1-8080-1) log4j:DEBUG Some message
If that's the case there is not a lot you can do. You could define a logger with a category stdout and give it a format of "%s%n". It seems it should work, though I admit I didn't test it.
--
James R. Perkins
-
2. Re: Log4j setting when using JBoss as 7.1.1.Final
hantsy Aug 22, 2012 10:26 PM (in response to jamezp)yes...it printed out the INFO message...
10:23:00,418 INFO [com.company.security.TicklerAuthenticator] (http-localhost-127.0.0.1-8080-2) Logging in hantsy
But the DEBUG messages for my project is not printed out.
Regards
hantsy
-
3. Re: Log4j setting when using JBoss as 7.1.1.Final
jamezp Aug 23, 2012 12:00 PM (in response to hantsy)In that case it doesn't look like your log4j configuration is being picked up. Is this a WAR or EAR? Where is the log4j configuration file located?
Also make sure you included a log4j library in your deployment. There is some information on the documentation too.
--
James R. Perkins
-
4. Re: Log4j setting when using JBoss as 7.1.1.Final
hantsy Aug 23, 2012 9:46 PM (in response to jamezp)it worked...but only print the INFO level info...I included two INFO message in my project, one for ApplciationInitializer and one for logged in, I saw the two messages when it was deployed into JBoss AS.
I have read the JBoss AS docuement, excluded the log4j dependencies in the deployment file, and added my log4j in my proejct.
My project is WAR packing. log4j.properties is in the classpath(src/main/resources), jboss-deployment-structure is in WEB-INF.
-
5. Re: Log4j setting when using JBoss as 7.1.1.Final
jamezp Aug 23, 2012 10:07 PM (in response to hantsy)It looks like the messages aren't using log4j's log manager. The pattern in the message you provided doesn't match the pattern in your log4j configuration file.
Try moving the jboss-deployment-structure.xml to the META-INF directory.
--
James R. Perkins
-
6. Re: Log4j setting when using JBoss as 7.1.1.Final
hantsy Aug 23, 2012 10:46 PM (in response to jamezp)the same result...
The jbosss deployment strcuture, either I put it into /META-INF or /WEB-INF or /WEB-INF/classes/META-INF, I got the same result.
<jboss-deployment-structure> <deployment> <!-- <dependencies> <module name="org.jboss.logmanager" /> </dependencies> --> <exclusions> <module name="org.apache.log4j" /> </exclusions> </deployment> </jboss-deployment-structure>
the log4.properties file, I think I must put into into the class path...I put it into /src/main/resouces, finally deployed into /WEB-INF/classes. if put it into the /WEB-INF/lib, I will got an error from Prettyfaces. I do not understand what is the "lib" in the JBoss documentation.
Log4j dependencies delcaration in pom.xml.
<dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.6.2</version> <scope>runtime</scope> </dependency> <dependency> <groupId>log4j</groupId> <artifactId>log4j</artifactId> <version>1.2.16</version> <scope>runtime</scope> </dependency>
-
7. Re: Log4j setting when using JBoss as 7.1.1.Final
jamezp Aug 23, 2012 10:48 PM (in response to hantsy)Hmmm... ...I'm not to sure what it could be. Is the WAR in an EAR by chance?
--
James R. Perkins
-
8. Re: Log4j setting when using JBoss as 7.1.1.Final
hantsy Aug 23, 2012 10:54 PM (in response to jamezp)A war package for the whole project, not EAR.
-
9. Re: Log4j setting when using JBoss as 7.1.1.Final
jamezp Aug 23, 2012 11:18 PM (in response to hantsy)Short of actually trying to deploy the same application I'm not sure what the issue could be. It seems like everything is setup okay, so I'm just not sure. I've successfully tested apps before with log4j.
--
James R. Perkins
-
10. Re: Log4j setting when using JBoss as 7.1.1.Final
hantsy Aug 24, 2012 2:09 AM (in response to jamezp)OK...I am not sure if this can be considered as a bug ...I have just updated my seam3-sandbox project on github, added deployment for jboss 7.1.1.Final.
https://github.com/hantsy/seam3-sandbox
I have just tried in JBoss 7.0.2.Final and JBoss 7.1.1.Final.
For jboss 7.0.2.Final:
mvn clean packaget jboss-as:deploy -Pjboss7
For JBoss 7.1.1.Final:
mvn clean package jboss-as:deploy -Pjboss71
If this is a bug, I will a new issue on JBoss JIRA.
BTW, the sandbox is a sample project where I was trying to use JBoss seam3 projects...do not care about the code quaulity here, care the logging only.
-
11. Re: Log4j setting when using JBoss as 7.1.1.Final
jamezp Aug 24, 2012 11:59 AM (in response to hantsy)Got it. You also need to exclude slf4j.
<jboss-deployment-structure> <deployment> <exclusions> <module name="org.apache.log4j" /> <module name="org.slf4j" /> </exclusions> </deployment> </jboss-deployment-structure>
That seemed to do the trick for me.
--
James R. Perkins
-
12. Re: Log4j setting when using JBoss as 7.1.1.Final
hantsy Aug 24, 2012 9:48 PM (in response to jamezp)Exactly, thanks
-
13. Re: Log4j setting when using JBoss as 7.1.1.Final
victorlich May 24, 2013 12:37 PM (in response to hantsy)Hi, sorry I ran into the same problem, try following the steps but still I can not fix it
I create a file jboss-deployment-structure.xml in the / META-INF but still do not show the debug, the info if the log shows
I think my project has the same structure and I think my problem would be solved in the same way, but maybe I'm missing some step
They could tell me what to do step by step to solve this problem, I'm new in this
Thanks in advance -
14. Re: Log4j setting when using JBoss as 7.1.1.Final
jamezp May 24, 2013 1:57 PM (in response to victorlich)Are you using JBoss AS 7.1.1.Final as well? Excluding the logging dependencies should be all you need to do with JBoss AS 7.1.x.Final. If you have other logging dependencies, like commons-logging, you might need to exclude those as well.
Also if it's an EAR you would need to exclude the logging dependencies for each subdeployment as well.
--
James R. Perkins