logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sujatha rdn <sujatha...@wavecrest.gi>
Subject RE: Issue with configuration status and Rolling Files
Date Tue, 07 Oct 2014 14:59:42 GMT
I think I found the issue of what it is. But couldn’t get the fix of that.

Actually I created two loggers from the same JAVA file. And then given their
configuration in log4j2.xml in the following way.

And I am accessing loggers in JAVA in the following way:
private static final org.slf4j.Logger slfLogger=
LoggerFactory.getLogger("webAnalyticLog");
private static final org.slf4j.Logger adminSlfLogger=
LoggerFactory.getLogger("adminAnalyticLog");

               <Logger name="webAnalyticLog" additivity="false">
                        <level value="debug"/>
                        <AppenderRef ref="AsynclogAnalytics"/>
                </Logger>
                <Logger name="adminAnalyticLog" additivity="false">
                        <level value="debug"/>
                        <AppenderRef ref="adminAsynclogAnalytics"/>
                </Logger>


Is this scenario possible ?? or should I do any change in the
configuration??

Herewith sharing my log4j2.xml configuration.

Thanks,
Sujatha

-----Original Message-----
From: Matt Sicker [mailto:boards@gmail.com]
Sent: Tuesday, October 07, 2014 7:19 PM
To: Log4J Users List
Subject: Re: Issue with configuration status and Rolling Files

Let me make sure I understand how you're deploying this. Are you including
this all in your webapp and deploying to Tomcat? As in not putting it in
Tomcat's lib directory (which if you did that, you shouldn't include
log4j-web; better support for this in upcoming 2.1 release)?

Also, what version of Tomcat? In older versions of Tomcat (like pre-7.0.43),
JARs named "log4j*.jar" would be ignored for certain things, though that may
only be relevant for Servlet 3.x autoconfig.

On 7 October 2014 05:36, Gary Gregory <garydgregory@gmail.com> wrote:

> Can you try version 2.0.2?
>
> Perhaps a local build of the master from git?
>
> Gary
>
> <div>-------- Original message --------</div><div>From: sujatha rdn
<
> sujathardn@wavecrest.gi> </div><div>Date:10/07/2014  04:46
> (GMT-05:00)
> </div><div>To: Log4J Users List <log4j-user@logging.apache.org>
> </div><div>Subject: RE: Issue with configuration status and Rolling
> Files </div><div> </div>Yes. I am using the following list of jars
in
> my webapp.
>
> log4j-api-2.0.jar
> log4j-slf4j-impl-2.0.jar ( as I am using slf4j as a interface in my
> application to connect to log4j2) log4j-core-2.0.jar log4j-web-2.0.jar
>
> Here is my log4j2.xml and web.xml as well.
>
> I have added a new log file in the log4j2.xml and then restarted my
> tomcat.
> It doesn’t create the new log file after successful start up of tomcat
> ( it only created the previous log files in the specified folder)
>
> Hence, I added the log4j2 configuration in JAVA_OPTS
> (-Dlog4j.configurationFile=file:///etc/config/xml/log4j2.xml) and
> restarted the tomcat. Now it created all the log files successfully
> and writes to files, but after some it wipes out.
>
> Log4j2 had created all the following log files and Analytics.log and
> APIRequestResponse.log is updated too.
> -rw-rw-r-- 1 wcuser wcuser    0 Oct  7 13:49 UserActivity.log
> -rw-rw-r-- 1 wcuser wcuser    0 Oct  7 13:49 Analytics_admin.log
> -rw-rw-r-- 1 wcuser wcuser    0 Oct  7 13:49 ruleAnalytics.log
> -rw-rw-r-- 1 wcuser wcuser  963 Oct  7 13:50 APIRequestResponse.log
> -rw-rw-r-- 1 wcuser wcuser 7079 Oct  7 13:50 Analytics.log
>
> But after some time , my Analytics.log goes to oKB.
> -rw-rw-r-- 1 wcuser wcuser   0 Oct  7 13:49 UserActivity.log
> -rw-rw-r-- 1 wcuser wcuser   0 Oct  7 13:49 Analytics_admin.log
> -rw-rw-r-- 1 wcuser wcuser   0 Oct  7 13:49 ruleAnalytics.log
> -rw-rw-r-- 1 wcuser wcuser 963 Oct  7 13:50 APIRequestResponse.log
> -rw-rw-r-- 1 wcuser wcuser   0 Oct  7 13:52 Analytics.log
>
> Am I doing something wrong in the configuration??
>
> -----Original Message-----
> From: Matt Sicker [mailto:boards@gmail.com]
> Sent: Monday, October 06, 2014 8:32 PM
> To: Log4J Users List
> Subject: Re: Issue with configuration status and Rolling Files
>
> Are you using log4j-web? Also, are you looking for Tomcat's logs to
> come from Log4j as well? Because that isn't possible without a JUL
> adapter (which Log4j 2.1 will have).
>
> On 6 October 2014 04:02, sujatha rdn <sujathardn@wavecrest.gi> wrote:
>
> > Yup.
> >
> > Herewith attaching the configuration file.
> >
> > And also, in my application, I will be accessing in the following way.
> >
> > Public class Logger{
> > private static final org.slf4j.Logger slfLogger=
> > LoggerFactory.getLogger("webAnalyticLog");
> > private static final org.slf4j.Logger adminSlfLogger=
> > LoggerFactory.getLogger("adminAnalyticLog");
> >
> > if(info.getServiceType() == ADMIN){
> >                         adminSlfLogger.info(message);
> >                 }else{
> >                         slfLogger.info(message);                }
> > }
> >
> > -----Original Message-----
> > From: Harinath Mallepally [mailto:harinath@careerscale.in]
> > Sent: Monday, October 06, 2014 2:22 PM
> > To: Log4J Users List
> > Subject: Re: Issue with configuration status and Rolling Files
> >
> > share the configuration file.
> >
> >
> >
> > Thanks
> > Harinath Mallepally
> > harinath@careerscale.in
> > Careerscale IT Consulting LLP
> > +91 9391920444 / 040-42100276
> > Hyderabad
> >
> > On Mon, Oct 6, 2014 at 2:17 PM, sujatha rdn
> > <sujathardn@wavecrest.gi>
> > wrote:
> >
> > > Hi,
> > >
> > >
> > >
> > > I have migrated to log4j2 with slf4j adapter. But I am facing some
> > issues.
> > >
> > >
> > >
> > > 1.       When I add configuration status <configuration status=”trace”>
> > > I
> > > don’t see any logs related to log4j in my catalina logs
> > >
> > > 2.       And also, I have 5 loggers mapped to 5 different rolling
> files.
> > > But only 4 files get created in the specified location and in that
> > > only one files gets updated with the logs.
> > >
> > >
> > >
> > > Here are some details that you want to know before you suggest me
> > > a solution.
> > >
> > > 1.       I am working on servlet 2.5 web application and our container
> > > is
> > > tomcat 7.
> > >
> > > 2.       I am using slf4j adapter as interface in my application to
> > access
> > > log4j2
> > >
> > >
> > >
> > > Do please let me know if you need any further details to help me out.
> > >
> > >
> > >
> > >
> > >
> > > Thanks,
> > >
> > > Sujatha
> > >
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
>
>
>
> --
> Matt Sicker <boards@gmail.com>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>



--
Matt Sicker <boards@gmail.com>

Mime
View raw message