[
https://issues.jboss.org/browse/JBAS-8791?page=com.atlassian.jira.plugin....
]
Jeff Zhang commented on JBAS-8791:
----------------------------------
To make log4j-appender work, Gregoire help to find the patch path:
1. download and unzip AS6.
2. upgrade log4j.jar to 1.2.16
3. apply patch JBAS-8791-1.zip. (3 jars into 3 different directories, replace old same
name jars)
4. change the jboss-logging.xml, add Log4jAppender appender
Here is our chat:
Hi Gregoire,
Cool, you are right, upgrade log4j to 1.2.16 can resolve log issue. :)
Regards
Jeff
On 01/17/2011 10:48 PM, Gregoire Botquin wrote:
Hi Jeff,
You're welcome.
I downloaded a new AS6 and you're right, it doesn' work as expected. Could you
try the following thing : change the version of the log4j.jar (in /client and /common/lib,
which is 1.2.14 in the distribution) to 1.2.16. This is a change I made 2 or 3 weeks ago,
but did'nt remembered that.
If this don't work send you all the steps I just made in order to make the log
working.
Rgds
Grégoire
-----Original Message-----
From: Jeff Zhang
Sent: lundi 17 janvier 2011 12:08
To: Gregoire Botquin
Subject: Re: [JBoss JIRA] Commented: (JBAS-8791) log4j-appender seems not working in
jboss-logging (AS6 final)
Hi Gregoire,
Thanks for your reply!
I modified jboss-logging.xml file like you, but it is not working. It is
so strange.
The mytest.log file could be created but it is always empty.
Could you help me to reproduce your successful steps in a new empty
directory? (unzip JBoss AS6, apply patch, modify logging.xml file, and
deploy ejb jar)
And if ok too, please send the logging.xml and ejb file to me.
I appreciate your help very much.
Regards
Jeff
On 01/17/2011 04:19 PM, Gregoire Botquin wrote:
> Hi Jeff
>
> The steps you explain are correct, I did the same things. Maybe my configuration did
slightly changed to what is described in jira. My test was made with the following
configuration (I declare the logger in the appender itself, don't know if this could
change something), and didn't add the Log4jAppender in the root-logger.
>
> <log4j-appender name="ALog4JAppender "
class="org.apache.log4j.DailyRollingFileAppender">
> <error-manager>
> <only-once/>
> </error-manager>
>
> <level name="INFO"/>
>
> <properties>
> <property
name="file">${jboss.server.log.dir}/mytest.log</property>
> <property name="append">true</property>
> <property
name="datePattern">'.'yyyy-MM-dd</property>
> </properties>
>
> <formatter>
> <pattern-formatter pattern="%d %m%n" />
> </formatter>
>
> <loggers>
> <logger category="com.sample" />
> </loggers>
> </log4j-appender>
>
> The bean I tested on has also changed its package (deeper package), but don't
think this will change something :
>
> package com.sample.mytest.level.lastlevel;
>
> import javax.ejb.Schedule;
> import javax.ejb.Stateless;
>
> import org.apache.log4j.Logger;
>
> @Stateless
> public class TestBean {
>
> public static final Logger LOG = Logger.getLogger(TestBean.class);
>
> @Schedule(second="*/20", minute="*",hour="*",
persistent=false)
> public void writeSomething(){
> try{
> System.out.println("INFO");
> LOG.info("This should log information in the file...");
>
> }
> catch(Exception e){
> e.printStackTrace();
> }
> }
>
> }
>
> Let me know,
> Rgds
> Gregoire
>
> -----Original Message-----
> From: Jeff Zhang
> Sent: dimanche 16 janvier 2011 05:05
> To:gregoire
> Subject: Re: [JBoss JIRA] Commented: (JBAS-8791) log4j-appender seems not working in
jboss-logging (AS6 final)
>
> Hi Gregoire,
>
> I also meet this log problem.
> I apply David's patch on AS 6 but not working like you said successfully.
>
> Could you tell me your step?
> My step is simple:
> 1. download and unzip AS6.
> 2. apply patch JBAS-8791-1.zip. (3 jars into 3 different directories,
> replace old same name jars)
> 3. change the jboss-logging.xml, add Log4jAppender appender like you.
> (change category name "com.sample")
> 4. start AS6, the log file is there, but it is always empty.
>
> Might I miss something?
log4j-appender seems not working in jboss-logging (AS6 final)
-------------------------------------------------------------
Key: JBAS-8791
URL:
https://issues.jboss.org/browse/JBAS-8791
Project: JBoss Application Server
Issue Type: Bug
Security Level: Public(Everyone can see)
Components: Logging
Affects Versions: 6.0.0.Final
Reporter: Gregoire Botquin
Assignee: David Lloyd
Labels: jboss-logging, log4j, log4j-appender, logging
Attachments: JBAS-8791-1.zip
We are using some custom logger based on log4j appenders. I made a jboss-logging.xml
configuration but it seems that my log4j-appender doesn't log anything. I'm
working in AS6 final version.
I made an example with a standard log4j appender (neither working). The category
"com.sample" should be managed by the log4jappender. Every second the bean
should write something, but nothing happens, the log file is not even created. I tried
with other log4j loggers/ custom loggers and no success.
When activating CONSOLE handler the logs are correctly written in console, but when only
using the log4j-appender nothing happens after server started.
The configuration file seems correct (?), but can't unfortunately check it against a
documentation yet.
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
<logging xmlns="urn:jboss:logging:6.0"
xmlns:b="urn:jboss:bean-deployer:2.0">
<!-- ================================= -->
<!-- Preserve messages in a local file -->
<!-- ================================= -->
<!-- A time/date based rolling handler -->
<periodic-rotating-file-handler
file-name="${jboss.server.log.dir}/server.log"
name="FILE"
autoflush="true"
append="true"
suffix=".yyyy-MM-dd"> <!-- To roll over at the top of each
hour, use ".yyyy-MM-dd-HH" instead -->
<error-manager>
<only-once/>
</error-manager>
<formatter>
<!-- To revert back to simple stack traces without JAR versions, change
"%E" to "%e" below. -->
<!-- Uncomment this to get the class name in the log as well as the category
<pattern-formatter pattern="%d %-5p [%c] %C{1} (%t) %s%E%n"/>
-->
<!-- Uncomment this to log without the class name in the log -->
<pattern-formatter pattern="%d %-5p [%c] (%t) %s%E%n"/>
</formatter>
</periodic-rotating-file-handler>
<!-- ============================== -->
<!-- Append messages to the console -->
<!-- ============================== -->
<console-handler name="CONSOLE" autoflush="true"
target="System.out">
<error-manager>
<only-once/>
</error-manager>
<level name="INFO"/>
<formatter>
<pattern-formatter pattern="%d{HH:mm:ss,SSS} %-5p [%c]
%s%E%n"/>
</formatter>
</console-handler>
<log4j-appender name="Log4jAppender"
class="org.apache.log4j.DailyRollingFileAppender">
<error-manager>
<only-once/>
</error-manager>
<level name="DEBUG"/>
<properties>
<!-- <property
name="directory">${jboss.server.log.dir}/</property> -->
<property
name="file">${jboss.server.log.dir}/log4j.log</property>
<property name="append">true</property>
<property name="datePattern">'.'yyyy-MM-dd</property>
</properties>
<formatter>
<pattern-formatter pattern="%d %-5p [%c] %m%n"/>
</formatter>
</log4j-appender>
<logger category="com.sample">
<level name="DEBUG"/>
<handlers>
<handler-ref name="Log4jAppender"/>
</handlers>
</logger>
<!-- ======================= -->
<!-- Setup the Root category -->
<!-- ======================= -->
<root-logger>
<!-- Set the root logger priority via a system property, with a default value.
-->
<level name="${jboss.server.log.threshold:INFO}"/>
<handlers>
<handler-ref name="Log4jAppender"/>
<!--
<handler-ref name="CONSOLE"/>
<handler-ref name="FILE"/>
-->
</handlers>
</root-logger>
</logging>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
package com.sample;
import javax.ejb.Schedule;
import javax.ejb.Stateless;
import org.apache.log4j.Logger;
//@Singleton
@Stateless
public class TestBean {
public static final Logger LOG = Logger.getLogger(TestBean.class);
public TestBean(){
System.out.println("TestBean is instantiated and should write someting in the log
file");
LOG.info("This is information log");
}
@Schedule(second="*/1", minute="*",hour="*",
persistent=false)
public void writeSomething(){
System.out.println("This should write something in the log file at scheduled
times");
LOG.info("This is scheduled information log");
}
}
--
This message is automatically generated by JIRA.
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira