Re: Issue with Tomcat auto-redeploy on Windows.

2013-04-22 Thread Remko Popma

Tushar Kapila  gmail.com> writes:

> 
> * why would a lib log4j or any other read its own jar? unless its to get 
> to a xml for config in it and is not closing it?


One thing I can think of is PluginManager. 
This class tries to read all Log4j2Plugins.dat files in the classpath
(incl the one in the core jar).

If an exception occurs during plugin initialization, 
this file is not closed: 
the call to inputstream.close is not in a finally block.

o.a.l.l.c.c.p.PluginManager#decode(ClassLoader) line 234

-Remko



> 
> * i would never install to program files as there are permission issues 
> on those folders especially with windows 7 try install on c:\apps\ (make 
> apps as a new folder)
> 
> On 4/18/2013 2:06 AM, Ralph Goers wrote:
> > Not that I am aware of.  If the web app is using the log4j 2 web module

to initialize and destroy its context I
> would expect this to work.
> >
> > Ralph
> >
> > On Apr 17, 2013, at 1:28 PM, Fabien Sanglard wrote:
> >
> >> It seems there is an issue with log4j 2 not closing the core JAR handle

on Windows.
> >> It prevents Tomcat from auto redeploying an app.
> >>
> >> Upon updating an hypothetical DiscoveryService.war in the 'webapps'

folder, the redeploy will fail:
> >>
> >> SEVERE: [C:\Program

Files\apache-tomcat-7.0.39\webapps\DiscoveryService\WEB-INF\lib] could
> not be completely deleted. The presence of the remaining files may cause

problems
> >>
> >> Upon inspection it looks like:
> >>
> >> C:\Program

Files\apache-tomcat-7.0.39\webapps\DiscoveryService\WEB-INF\lib\log4j-
core-2.0-beta4.jar
> >>
> >> Cannot be deleted :/ ! Is there anything special to do so log4j 2 close

the JAR handle ?
> >>
> >> Fab
> >>
> >> -
> >> To unsubscribe, e-mail: log4j-user-unsubscribe  logging.apache.org
> >> For additional commands, e-mail: log4j-user-help  
logging.apache.org
> >>
> >
> > -
> > To unsubscribe, e-mail: log4j-user-unsubscribe  logging.apache.org
> > For additional commands, e-mail: log4j-user-help  logging.apache.org
> >
> >
> 





-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: General config question for Log4J2

2013-04-23 Thread Remko Popma
I don't think the docs have an example yet. This one worked for me:



  

  
%d %-5p %c{1.} [%t] %m %ex%n
  


  
%d %-5p %c{1.} [%t] %m %ex%n
  

  
  

  
  

  



Sent from my iPhone

On 2013/04/24, at 9:22, Peter DePasquale  wrote:

> Can you point me to an example in the documentation?  I didn't see anything
> like that in there, that I recall...
> 
> 
> On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers 
> wrote:
> 
>> You cannot have two root loggers but you can have multiple appender-refs
>> on them.  Each appender-ref can have its own log level so I believe you get
>> the same behavior that you are looking for.
>> 
>> Ralph
>> 
>> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
>> 
>>> Is it possible to use two root loggers, one to capture trace and one to
>>> capture errors (or more generally, two different levels)? If so, can
>>> someone please provide a simple config example? Thanks.
>>> 
>>> --
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
>> 
>> 
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> 
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255


Re: General config question for Log4J2

2013-04-23 Thread Remko Popma
I see. I understood Peter's question differently. Let's hope one of our answers 
solves his problem! :-)

Sent from my iPhone

On 2013/04/24, at 9:46, Ralph Goers  wrote:

> Your trace file will also contain info and above. From Peter's question I 
> understood him to mean he only wants events at that level.  We don't have a 
> filter that does that specifically so I used two threshold filters to do it.
> 
> Ralph
> 
> On Apr 23, 2013, at 5:42 PM, Remko Popma wrote:
> 
>> I don't think the docs have an example yet. This one worked for me:
>> 
>> 
>> 
>> 
>>   
>> 
>>   %d %-5p %c{1.} [%t] %m %ex%n
>> 
>>   
>>   
>> 
>>   %d %-5p %c{1.} [%t] %m %ex%n
>> 
>>   
>> 
>> 
>>   
>> 
>> 
>>   
>> 
>> 
>> 
>> 
>> Sent from my iPhone
>> 
>> On 2013/04/24, at 9:22, Peter DePasquale  wrote:
>> 
>>> Can you point me to an example in the documentation?  I didn't see anything
>>> like that in there, that I recall...
>>> 
>>> 
>>> On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers 
>>> wrote:
>>> 
>>>> You cannot have two root loggers but you can have multiple appender-refs
>>>> on them.  Each appender-ref can have its own log level so I believe you get
>>>> the same behavior that you are looking for.
>>>> 
>>>> Ralph
>>>> 
>>>> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
>>>> 
>>>>> Is it possible to use two root loggers, one to capture trace and one to
>>>>> capture errors (or more generally, two different levels)? If so, can
>>>>> someone please provide a simple config example? Thanks.
>>>>> 
>>>>> --
>>>>> Peter J. DePasquale, Ph.D.
>>>>> Department of Computer Science
>>>>> The College of New Jersey
>>>>> (e) depasqua [at] tcnj [dot] edu
>>>>> (p) 609-771-2806
>>>>> (f) 609-637-5190
>>>>> (o) Holman Hall - Room 238
>>>>> (l) Holman Hall - Room 255
>>>> 
>>>> 
>>>> -
>>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>> 
>>> 
>>> -- 
>>> Peter J. DePasquale, Ph.D.
>>> Department of Computer Science
>>> The College of New Jersey
>>> (e) depasqua [at] tcnj [dot] edu
>>> (p) 609-771-2806
>>> (f) 609-637-5190
>>> (o) Holman Hall - Room 238
>>> (l) Holman Hall - Room 255
> 
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: General config question for Log4J2

2013-04-23 Thread Remko Popma
Peter,

I understand your frustration. 
Let me try to help. 
I'm at work now, so please understand if I am unable to reply to your messages 
immediately. 

First, I tried to do what you did originally (in your March 25th post), which 
is a root logger and a named logger, each having a different level and 
configured with a different appender. This didn't work for me (one empty log 
file).
I'll try to understand exactly what happens and update the docs. 

It looks like the level of the named logger determines the filtering, and after 
that (if additivity is not switched off), the event is passed to the parent 
(root) logger without any level checking. If the named logger filters out the 
event based on its level, the parent (root) logger won't even see the event. 

Meanwhile, I hope that having one single root logger with multiple appender 
refs configured at different levels:
>  
>  

solves that issue. 

I'll look at your code posted on git next. 

One thing though:
This project is very much a work in progress. We do our best to create good 
code and docs, but we are coming at this from a coder's perspective. 
Which is why your feedback is extremely valuable. You are able to point out 
things that we missed because of your fresh perspective. 
I just wanted to let you know that your questions will improve the product. 

So, thank you. 
(This may be but small compensation for your frustration, but there it is.)

Best regards,
Remko

Sent from my iPhone

On 2013/04/24, at 9:53, Peter DePasquale  wrote:

> I am having a very difficult time learning the configuration system and am
> very frustrated by the documentation. I had hoped to learn the system well
> enough to possibly contribute to the project with respect to a tutorial or
> other documentation, but I've concluded that I can no longer spend so much
> time trying to work with log4j2 and not focus on my project, which sorely
> needed logging.
> 
> I wanted to next learn where the documentation for this like the following
> are discussed:
>  
>  
> 
> But I can't find anything about this either. My questions seem to only lead
> to more questions and no answers.
> 
> I'm sorry, but even despite my simple use cases where I'd like to separate
> out types of logging into different files, and with my earlier unsolved
> issues related to L4J's application for a web app in Tomcat, I'm very
> frustrated.
> 
> Perhaps someday the project documentation will mature to the point where I
> can learn how to use the software from a novice's (to logging) perspective.
> 
> 
> On Tue, Apr 23, 2013 at 8:46 PM, Ralph Goers 
> wrote:
> 
>> Your trace file will also contain info and above. From Peter's question I
>> understood him to mean he only wants events at that level.  We don't have a
>> filter that does that specifically so I used two threshold filters to do it.
>> 
>> Ralph
>> 
>> On Apr 23, 2013, at 5:42 PM, Remko Popma wrote:
>> 
>>> I don't think the docs have an example yet. This one worked for me:
>>> 
>>> 
>>> 
>>> 
>>>   
>>> 
>>>   %d %-5p %c{1.} [%t] %m %ex%n
>>> 
>>>   
>>>   
>>> 
>>>   %d %-5p %c{1.} [%t] %m %ex%n
>>> 
>>>   
>>> 
>>> 
>>>   
>>> 
>>> 
>>>   
>>> 
>>> 
>>> 
>>> 
>>> Sent from my iPhone
>>> 
>>> On 2013/04/24, at 9:22, Peter DePasquale 
>> wrote:
>>> 
>>>> Can you point me to an example in the documentation?  I didn't see
>> anything
>>>> like that in there, that I recall...
>>>> 
>>>> 
>>>> On Tue, Apr 23, 2013 at 6:28 PM, Ralph Goers <
>> ralph.go...@dslextreme.com>wrote:
>>>> 
>>>>> You cannot have two root loggers but you can have multiple
>> appender-refs
>>>>> on them.  Each appender-ref can have its own log level so I believe
>> you get
>>>>> the same behavior that you are looking for.
>>>>> 
>>>>> Ralph
>>>>> 
>>>>> On Apr 23, 2013, at 12:37 PM, Peter DePasquale wrote:
>>>>> 
>>>>>> Is it possible to use two root loggers, one to capture trace and one
>> to
>>>>>> capture errors (or more generally, two different levels)? If so, can
>>>>>> someone please provide a simple config example? Thanks.
>>>>>> 
>>>>>> --
>>>>>> Peter J. DePasquale, Ph.D.
>>>>>> Departm

Re: Simple test case for logging uner a tomcat web app

2013-04-23 Thread Remko Popma
Peter,

I don't have Tomcat installed but I was able to reproduce the problem in a 
standalone test using your configuration.

There is a couple of things I found.
First, File appenders have these configuration settings by default:
bufferedIO="true" and immediateFlush="false".

This means that messages will not be written to disk until the buffer is full.
I think we should improved the documentation for this and I've filed this JIRA 
ticket:
https://issues.apache.org/jira/browse/LOG4J2-218


Second, looks like you found a bug!
Even after adding immediateFlush="true" to the File config, the trace-log.txt 
file is empty.

I don't understand the underlying cause yet, but if the config has a named 
logger 
and no root logger, the named logger internally ends up with no Appender 
objects.
I've filed another JIRA for this:
https://issues.apache.org/jira/browse/LOG4J2-219


Workaround:
1. Specify immediateFlush="true" in the File appender config
2. Replace the named logger with a root logger configuration

The config below worked for me. 
(In my standalone test, that is. I haven't installed Tomcat.
Can you try this and let me know if there is any problem?)
















Sent from my iPhone

On 2013/04/24, at 10:13, Peter DePasquale  wrote:

> I continue to struggle achieving basic logging results under my web app
> under tomcat. It seemed to work months ago, but when I upgraded to the
> latest beta logging failed.
> 
> I returned to examine my config and failed to solve the problem. I emailed
> this list about this and I received no response. After asking for help a
> second time Ralph suggested I post code.
> 
> Thus, I have attempted to simplify my problem down and post a VERY SIMPLE
> web app that attempts to do trace and error logging.  I was trying to get
> this into to separate files, but I'm learning that that's apparently not
> really the model I should embrace as a logging novice.
> 
> Now I have trace logging going to one file. However, despite the app
> running successfully, an empty log file is created.  I can't determine what
> I'm doing wrong and seek help one last time on my inability to grasp the
> correct form for logging of this nature.
> 
> I really don't want to go back to println statements, but if I can't make
> this work, I will. My application is my academic research project and I'm
> delayed in developing new features because I got mired down in trying to
> solve these issues so that I can support logging in my app (seemed smart at
> the time).
> 
> Regardless, the code is posted here at github. I welcome any help that
> anyone can provide by download or visual inspection. I am posting this and
> setting away for the night as I can not work on this today any longer.
> 
> My setup is a Mac OSX 10.6 running Tomcat 7.0.37 locally. Beyond the basic
> apps that Tomcat is preloaded with, this is the only running app.
> 
> https://github.com/depasqua/log4j2tester
> 
> Thanks. Sorry for my vent.
> -- 
> Peter J. DePasquale, Ph.D.
> Department of Computer Science
> The College of New Jersey
> (e) depasqua [at] tcnj [dot] edu
> (p) 609-771-2806
> (f) 609-637-5190
> (o) Holman Hall - Room 238
> (l) Holman Hall - Room 255


Re: [ANNOUCMENT] Welcome Remko Popma

2013-04-24 Thread Remko Popma
Thank you all for your kind words. 
Looking forward to working with you all to make log4j2 even more awesome. 

Remko

Sent from my iPhone

On 2013/04/24, at 21:54, Ralph Goers  wrote:

> Welcome Remko!  I am greatly looking forward to your continuing contributions.
> 
> Ralph
> 
> On Apr 24, 2013, at 12:49 AM, Christian Grobmeier  wrote:
> 
>> Hi all,
>> 
>> it is my pleasure to announce to the community
>> that Remko Popma has joined our ranks.
>> 
>> He made remarkable contributions to log4j 2
>> and we all believe he is a valuable member
>> of Apache Logging Services now and in future.
>> 
>> Kind regards,
>> Christian
>> 
>> -
>> To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-dev-h...@logging.apache.org
>> 
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Simple test case for logging uner a tomcat web app

2013-04-24 Thread Remko Popma
Peter,

Glad to be of help. 

First, you NEED a root logger. I finished analysis of the bug and other loggers 
are ignored if no root element exists. 
Not sure yet if we'll fix the code or the docs, but that is the behavior of 
beta5. 

The default (nameless) package doesn't play well with logger names. 
You'd need to specify the class name as the logger name. Wildcarts like "*" 
won't work. "" didn't work for me. Better use the root logger. 
(In your own code I'd strongly recommend using packages for anything that isn't 
throw-away code. )

Hope this helps,
Remko

Sent from my iPhone

On 2013/04/25, at 11:59, Peter DePasquale  wrote:

> Thanks Remko, you have validated my sanity.
> 
> I was finally able to sit down tonight and integrate in your suggestions
> and all works well. I'm also thrilled to have found a bug! Now I can return
> to successful logging in my application and track down a bunch of other
> problems on my end.
> 
> I'm sure I will have additional questions... oh here's one...
> 
> As a college instructor of Java we often don't teach packaging in the first
> semester, so I see a lot of code that is not packaged.
> 
> As I was fiddling with my test case, I attempted (earlier) to use
> unpackaged code and to make a named logger to catch the trace messages. I'm
> guessing that I should really use a root logger for this, but are named
> loggers able to support unpackaged code?
> 
> That is, can I do this?
> 
> 
>  
>
>  
> 
> 
> Or, should one use: name=""?  I think I actually got this to work once, but
> it was not clear if this is a valid approach. Again, I'm guessing the root
> logger is the way to go here.
> 
> Thanks again for the help!
> 
> 
> 
> On Wed, Apr 24, 2013 at 1:39 AM, Remko Popma  wrote:
> 
>> Peter,
>> 
>> I don't have Tomcat installed but I was able to reproduce the problem in a
>> standalone test using your configuration.
>> 
>> There is a couple of things I found.
>> First, File appenders have these configuration settings by default:
>> bufferedIO="true" and immediateFlush="false".
>> 
>> This means that messages will not be written to disk until the buffer is
>> full.
>> I think we should improved the documentation for this and I've filed this
>> JIRA ticket:
>> https://issues.apache.org/jira/browse/LOG4J2-218
>> 
>> 
>> Second, looks like you found a bug!
>> Even after adding immediateFlush="true" to the File config, the
>> trace-log.txt file is empty.
>> 
>> I don't understand the underlying cause yet, but if the config has a named
>> logger
>> and no root logger, the named logger internally ends up with no Appender
>> objects.
>> I've filed another JIRA for this:
>> https://issues.apache.org/jira/browse/LOG4J2-219
>> 
>> 
>> Workaround:
>> 1. Specify immediateFlush="true" in the File appender config
>> 2. Replace the named logger with a root logger configuration
>> 
>> The config below worked for me.
>> (In my standalone test, that is. I haven't installed Tomcat.
>> Can you try this and let me know if there is any problem?)
>> 
>> 
>> 
>>
>>> fileName="${sys:catalina.base}/logs/trace-log.txt"
>>immediateFlush="true" append="false">
>>
>>
>>
>> 
>>
>>
>>
>>
>>
>> 
>> 
>> Sent from my iPhone
>> 
>> On 2013/04/24, at 10:13, Peter DePasquale 
>> wrote:
>> 
>>> I continue to struggle achieving basic logging results under my web app
>>> under tomcat. It seemed to work months ago, but when I upgraded to the
>>> latest beta logging failed.
>>> 
>>> I returned to examine my config and failed to solve the problem. I
>> emailed
>>> this list about this and I received no response. After asking for help a
>>> second time Ralph suggested I post code.
>>> 
>>> Thus, I have attempted to simplify my problem down and post a VERY SIMPLE
>>> web app that attempts to do trace and error logging.  I was trying to get
>>> this into to separate files, but I'm learning that that's apparently not
>>> really the model I should embrace as a logging novice.
>>> 
>>> Now I have trace logging going to one file. However, despite the app
>>> ru

Re: Simple test case for logging uner a tomcat web app

2013-04-25 Thread Remko Popma
Peter,

I see. Well, best keep it simple then with just a root logger.
A fairly standard industry practice I've seen is to configure
an INFO, WARN or ERROR level Console appender and
a DEBUG or TRACE File appender.

INFO is recommended to only be used for events that
happen only once (like initialization).

Be aware that System.out (the Console) is notoriously s.l..o...w

-Remko



 From: Peter DePasquale 
To: Log4J Users List  
Sent: Thursday, April 25, 2013 8:54 PM
Subject: Re: Simple test case for logging uner a tomcat web app
 

Remko,

Thanks for clarifying. One of the reasons that I asked, was that I was
thinking of incorporating a section of logging in a Java program with some
of my introductory course materials. Here, we go about a semester and a
half before we introduce packaging. Thus, the occurrence of default
packaged code.


On Thu, Apr 25, 2013 at 1:05 AM, Remko Popma  wrote:

> Peter,
>
> Glad to be of help.
>
> First, you NEED a root logger. I finished analysis of the bug and other
> loggers are ignored if no root element exists.
> Not sure yet if we'll fix the code or the docs, but that is the behavior
> of beta5.
>
> The default (nameless) package doesn't play well with logger names.
> You'd need to specify the class name as the logger name. Wildcarts like
> "*" won't work. "" didn't work for me. Better use the root logger.
> (In your own code I'd strongly recommend using packages for anything that
> isn't throw-away code. )
>
> Hope this helps,
> Remko
>
> Sent from my iPhone
>
> On 2013/04/25, at 11:59, Peter DePasquale 
> wrote:
>
> > Thanks Remko, you have validated my sanity.
> >
> > I was finally able to sit down tonight and integrate in your suggestions
> > and all works well. I'm also thrilled to have found a bug! Now I can
> return
> > to successful logging in my application and track down a bunch of other
> > problems on my end.
> >
> > I'm sure I will have additional questions... oh here's one...
> >
> > As a college instructor of Java we often don't teach packaging in the
> first
> > semester, so I see a lot of code that is not packaged.
> >
> > As I was fiddling with my test case, I attempted (earlier) to use
> > unpackaged code and to make a named logger to catch the trace messages.
> I'm
> > guessing that I should really use a root logger for this, but are named
> > loggers able to support unpackaged code?
> >
> > That is, can I do this?
> >
> > 
> >  
> >    
> >  
> > 
> >
> > Or, should one use: name=""?  I think I actually got this to work once,
> but
> > it was not clear if this is a valid approach. Again, I'm guessing the
> root
> > logger is the way to go here.
> >
> > Thanks again for the help!
> >
> >
> >
> > On Wed, Apr 24, 2013 at 1:39 AM, Remko Popma  wrote:
> >
> >> Peter,
> >>
> >> I don't have Tomcat installed but I was able to reproduce the problem
> in a
> >> standalone test using your configuration.
> >>
> >> There is a couple of things I found.
> >> First, File appenders have these configuration settings by default:
> >> bufferedIO="true" and immediateFlush="false".
> >>
> >> This means that messages will not be written to disk until the buffer is
> >> full.
> >> I think we should improved the documentation for this and I've filed
> this
> >> JIRA ticket:
> >> https://issues.apache.org/jira/browse/LOG4J2-218
> >>
> >>
> >> Second, looks like you found a bug!
> >> Even after adding immediateFlush="true" to the File config, the
> >> trace-log.txt file is empty.
> >>
> >> I don't understand the underlying cause yet, but if the config has a
> named
> >> logger
> >> and no root logger, the named logger internally ends up with no Appender
> >> objects.
> >> I've filed another JIRA for this:
> >> https://issues.apache.org/jira/browse/LOG4J2-219
> >>
> >>
> >> Workaround:
> >> 1. Specify immediateFlush="true" in the File appender config
> >> 2. Replace the named logger with a root logger configuration
> >>
> >> The config below worked for me.
> >> (In my standalone test, that is. I haven't installed Tomcat.
> >> Can you try this and let me know if there is any problem?)
> >>
> >> 
> >> 
> >>        
> >

Re: How to use FastFile

2013-04-27 Thread Remko Popma
Hi,

FastFile appenders are buffered. 
You won't see output in the log file until you log a lot. 

To see output immediately you should either specify immediateFlush=true or use 
Async Loggers or AsynchAppender (they will auto-flush efficiently). 

Hope this helps,
Remko

Sent from my iPhone

On 2013/04/27, at 18:36, Steven Yang  wrote:

> I am using log4j beta5 and want to try async file appender FastFile.
> However I could not get it to work.
> I have built the disruptor jar using project from
> https://github.com/LMAX-Exchange/disruptor so my disruptor is 3.0.1 not
> 3.0.0, dont know if it matters.
> 
> I simply follow the sample setup from
> http://logging.apache.org/log4j/2.x/manual/async.html#Performance.
> 
> But I could not see anything log into my log file, I can see the log file
> created but nothing inside.
> If I simply change from FastFile to File, I can see all the logs that
> suppose to appear.
> I have the following jars in my project
> log4j-api-2.0-beta5.jar
> log4j-core-2.0-beta5.jar
> log4j-jcl-2.0-beta5.jar
> log4j-slf4j-impl-2.0-beta5.jar
> 
> In my project I mainly use slf4j but even if I try to use log4j api direct,
> it still doesnt work.
> 
> here is my log4j2.xml
> 
> 
>
> fileName="D:/Projects/TestingProject/logs/log4jtest.log"
> immediateFlush="false" append="false" suppressExceptions="false">
>  
>%d %p %c{1.} [%t] %m %ex%n
>  
>
>  
>  
>
>  
>
>  
> 
> 
> What am I doing wrong? or do I need to check for any dependency for
> disruptor?
> 
> Thanks

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: How to use FastFile

2013-04-27 Thread Remko Popma
Two more things: 

disruptor 3.0.1 is fine. 

Your layout pattern doesn't actually use location, so if you use Async (Logger 
or Appender) I'd recommend you set includeLocation=false for better 
performance. 

Remko

Sent from my iPhone

On 2013/04/27, at 18:59, Remko Popma  wrote:

> Hi,
> 
> FastFile appenders are buffered. 
> You won't see output in the log file until you log a lot. 
> 
> To see output immediately you should either specify immediateFlush=true or 
> use Async Loggers or AsynchAppender (they will auto-flush efficiently). 
> 
> Hope this helps,
> Remko
> 
> Sent from my iPhone
> 
> On 2013/04/27, at 18:36, Steven Yang  wrote:
> 
>> I am using log4j beta5 and want to try async file appender FastFile.
>> However I could not get it to work.
>> I have built the disruptor jar using project from
>> https://github.com/LMAX-Exchange/disruptor so my disruptor is 3.0.1 not
>> 3.0.0, dont know if it matters.
>> 
>> I simply follow the sample setup from
>> http://logging.apache.org/log4j/2.x/manual/async.html#Performance.
>> 
>> But I could not see anything log into my log file, I can see the log file
>> created but nothing inside.
>> If I simply change from FastFile to File, I can see all the logs that
>> suppose to appear.
>> I have the following jars in my project
>> log4j-api-2.0-beta5.jar
>> log4j-core-2.0-beta5.jar
>> log4j-jcl-2.0-beta5.jar
>> log4j-slf4j-impl-2.0-beta5.jar
>> 
>> In my project I mainly use slf4j but even if I try to use log4j api direct,
>> it still doesnt work.
>> 
>> here is my log4j2.xml
>> 
>> 
>>   
>>   > fileName="D:/Projects/TestingProject/logs/log4jtest.log"
>> immediateFlush="false" append="false" suppressExceptions="false">
>> 
>>   %d %p %c{1.} [%t] %m %ex%n
>> 
>>   
>> 
>> 
>>   
>> 
>>   
>> 
>> 
>> 
>> What am I doing wrong? or do I need to check for any dependency for
>> disruptor?
>> 
>> Thanks
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: How to use FastFile

2013-04-27 Thread Remko Popma
(Including Steven in recipients)

Sent from my iPhone

On 2013/04/27, at 19:06, Remko Popma  wrote:

> Two more things: 
> 
> disruptor 3.0.1 is fine. 
> 
> Your layout pattern doesn't actually use location, so if you use Async 
> (Logger or Appender) I'd recommend you set includeLocation=false for better 
> performance. 
> 
> Remko
> 
> Sent from my iPhone
> 
> On 2013/04/27, at 18:59, Remko Popma  wrote:
> 
>> Hi,
>> 
>> FastFile appenders are buffered. 
>> You won't see output in the log file until you log a lot. 
>> 
>> To see output immediately you should either specify immediateFlush=true or 
>> use Async Loggers or AsynchAppender (they will auto-flush efficiently). 
>> 
>> Hope this helps,
>> Remko
>> 
>> Sent from my iPhone
>> 
>> On 2013/04/27, at 18:36, Steven Yang  wrote:
>> 
>>> I am using log4j beta5 and want to try async file appender FastFile.
>>> However I could not get it to work.
>>> I have built the disruptor jar using project from
>>> https://github.com/LMAX-Exchange/disruptor so my disruptor is 3.0.1 not
>>> 3.0.0, dont know if it matters.
>>> 
>>> I simply follow the sample setup from
>>> http://logging.apache.org/log4j/2.x/manual/async.html#Performance.
>>> 
>>> But I could not see anything log into my log file, I can see the log file
>>> created but nothing inside.
>>> If I simply change from FastFile to File, I can see all the logs that
>>> suppose to appear.
>>> I have the following jars in my project
>>> log4j-api-2.0-beta5.jar
>>> log4j-core-2.0-beta5.jar
>>> log4j-jcl-2.0-beta5.jar
>>> log4j-slf4j-impl-2.0-beta5.jar
>>> 
>>> In my project I mainly use slf4j but even if I try to use log4j api direct,
>>> it still doesnt work.
>>> 
>>> here is my log4j2.xml
>>> 
>>> 
>>>  
>>>  >> fileName="D:/Projects/TestingProject/logs/log4jtest.log"
>>> immediateFlush="false" append="false" suppressExceptions="false">
>>>
>>>  %d %p %c{1.} [%t] %m %ex%n
>>>
>>>  
>>> 
>>> 
>>>  
>>>
>>>  
>>> 
>>> 
>>> 
>>> What am I doing wrong? or do I need to check for any dependency for
>>> disruptor?
>>> 
>>> Thanks
>> 
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: How to use FastFile

2013-04-27 Thread Remko Popma
Steven,

In your config, instead of , try . You need the disruptor jar 
on the classpath. This will result in events being flushed to disk immediately, 
but in an efficient way: in batches, not one by one. 

I need to take a look at the behavior on Tomcat shutdown. There is a shutdown 
hook that should flush remaining events, but perhaps you found a bug.

Can you try  and let me know if that resolves the issue?

Sent from my iPhone

On 2013/04/27, at 23:27, Steven Yang  wrote:

> Thanks Remko for the comment
> 
> Ok I now understand why I dont see the log. 
> I am running in a tomcat, but when I shutdown my web server I dont see log 
> being flushed out to file. 
> Does that mean even when I run my application for a while and even after some 
> logs are flushed out then I shutdown my server there will be some log entries 
> left in memory and lost?
> 
> 
> On Sat, Apr 27, 2013 at 6:51 PM, Remko Popma  wrote:
>> (Including Steven in recipients)
>> 
>> Sent from my iPhone
>> 
>> On 2013/04/27, at 19:06, Remko Popma  wrote:
>> 
>> > Two more things:
>> >
>> > disruptor 3.0.1 is fine.
>> >
>> > Your layout pattern doesn't actually use location, so if you use Async 
>> > (Logger or Appender) I'd recommend you set includeLocation=false for 
>> > better performance.
>> >
>> > Remko
>> >
>> > Sent from my iPhone
>> >
>> > On 2013/04/27, at 18:59, Remko Popma  wrote:
>> >
>> >> Hi,
>> >>
>> >> FastFile appenders are buffered.
>> >> You won't see output in the log file until you log a lot.
>> >>
>> >> To see output immediately you should either specify immediateFlush=true 
>> >> or use Async Loggers or AsynchAppender (they will auto-flush efficiently).
>> >>
>> >> Hope this helps,
>> >> Remko
>> >>
>> >> Sent from my iPhone
>> >>
>> >> On 2013/04/27, at 18:36, Steven Yang  wrote:
>> >>
>> >>> I am using log4j beta5 and want to try async file appender FastFile.
>> >>> However I could not get it to work.
>> >>> I have built the disruptor jar using project from
>> >>> https://github.com/LMAX-Exchange/disruptor so my disruptor is 3.0.1 not
>> >>> 3.0.0, dont know if it matters.
>> >>>
>> >>> I simply follow the sample setup from
>> >>> http://logging.apache.org/log4j/2.x/manual/async.html#Performance.
>> >>>
>> >>> But I could not see anything log into my log file, I can see the log file
>> >>> created but nothing inside.
>> >>> If I simply change from FastFile to File, I can see all the logs that
>> >>> suppose to appear.
>> >>> I have the following jars in my project
>> >>> log4j-api-2.0-beta5.jar
>> >>> log4j-core-2.0-beta5.jar
>> >>> log4j-jcl-2.0-beta5.jar
>> >>> log4j-slf4j-impl-2.0-beta5.jar
>> >>>
>> >>> In my project I mainly use slf4j but even if I try to use log4j api 
>> >>> direct,
>> >>> it still doesnt work.
>> >>>
>> >>> here is my log4j2.xml
>> >>>
>> >>> 
>> >>>  
>> >>>  > >>> fileName="D:/Projects/TestingProject/logs/log4jtest.log"
>> >>> immediateFlush="false" append="false" suppressExceptions="false">
>> >>>
>> >>>  %d %p %c{1.} [%t] %m %ex%n
>> >>>
>> >>>  
>> >>> 
>> >>> 
>> >>>  
>> >>>
>> >>>  
>> >>> 
>> >>> 
>> >>>
>> >>> What am I doing wrong? or do I need to check for any dependency for
>> >>> disruptor?
>> >>>
>> >>> Thanks
>> >>
>> >> -
>> >> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> >> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>> >
>> > -
>> > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> > For additional commands, e-mail: log4j-user-h...@logging.apache.org
>> >
> 


Re: How to use FastFile

2013-04-27 Thread Remko Popma
Steven,

The buffer size used in FastAppenders is 256 Kb.
Glad that with asyncRoot you are seeing logs.

With asyncRoot, log events are first stored in a ringbuffer, then a separate 
thread takes them out and logs them to a file.
Based on the log snippet you attached, it looks like we need to check if and 
how tomcat signals a shutdown and if we can pick up that signal to shutdown the 
threadpool.
Thanks for bringing it to our attention!

I have filed Jira ticket LOG4J2-222 for this. I will take a look and see what I 
can do. This may take some time.

Best regards,
Remko



 From: Steven Yang 
To: Remko Popma  
Sent: Sunday, April 28, 2013 9:43 AM
Subject: Re: How to use FastFile
 


Thanks, I tried using asyncRoot and everything seems to log fine and I do see a 
lot of logs.
And logs do seem to be flushed immediately so I do not know if the hook on 
shutdown is been called correctly or not.

I am using struts and spring so I see a lot of logs (log level at DEBUG) just 
by starting up tomcat, so I am wondering when I use  how come I dont see 
any log at all? how much log do I have to write before it starts to flush out? 

and one thing I found is that when I use asyncRoot and when I shutdown tomcat I 
see the following message regarding to clearing references and thread local.
The last one is related to log4j.

四月 28, 2013 8:34:46 上午 org.apache.catalina.loader.WebappClassLoader 
clearReferencesJdbc
SEVERE: The web application [/test] registered the JBDC driver [org.h2.Driver] 
but failed to unregister it when the web application was stopped. To prevent a 
memory leak, the JDBC Driver has been forcibly unregistered.
四月 28, 2013 8:34:46 上午 org.apache.catalina.loader.WebappClassLoader 
clearReferencesThreads
SEVERE: The web application [/test] appears to have started a thread named 
[pool-2-thread-1] but has failed to stop it. This is very likely to create a 
memory leak.
四月 28, 2013 8:34:46 上午 org.apache.catalina.loader.WebappClassLoader 
clearThreadLocalMap
SEVERE: The web application [/test] created a ThreadLocal with key of type 
[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@454e119d]) and a value of 
type [com.opensymphony.xwork2.inject.ContainerImpl] (value 
[com.opensymphony.xwork2.inject.ContainerImpl@8667df7]) but failed to remove it 
when the web application was stopped. This is very likely to create a memory 
leak.
四月 28, 2013 8:34:46 上午 org.apache.catalina.loader.WebappClassLoader 
clearThreadLocalMap
SEVERE: The web application [/test] created a ThreadLocal with key of type 
[java.lang.ThreadLocal] (value [java.lang.ThreadLocal@d7e770]) and a value of 
type [org.apache.logging.log4j.core.impl.Log4jLogEvent] (value 
[Logger=org.springframework.beans.factory.support.DefaultListableBeanFactory 
Level=INFO Message=Destroying singletons in 
org.springframework.beans.factory.support.DefaultListableBeanFactory@61e118f9: 
defining beans 
[org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframewo...

I am trying this on tomcat 6.0.29. 
However the thing is that I dont see the message when I use .




On Sun, Apr 28, 2013 at 12:07 AM, Remko Popma  wrote:

Steven,
>
>
>In your config, instead of , try . You need the disruptor jar 
>on the classpath. This will result in events being flushed to disk 
>immediately, but in an efficient way: in batches, not one by one. 
>
>
>I need to take a look at the behavior on Tomcat shutdown. There is a shutdown 
>hook that should flush remaining events, but perhaps you found a bug.
>
>
>Can you try  and let me know if that resolves the issue?
>
>Sent from my iPhone
>
>On 2013/04/27, at 23:27, Steven Yang  wrote:
>
>
>Thanks Remko for the comment
>>
>>
>>Ok I now understand why I dont see the log. 
>>I am running in a tomcat, but when I shutdown my web server I dont see log 
>>being flushed out to file. 
>>Does that mean even when I run my application for a while and even after some 
>>logs are flushed out then I shutdown my server there will be some log entries 
>>left in memory and lost?
>>
>>
>>
>>On Sat, Apr 27, 2013 at 6:51 PM, Remko Popma  wrote:
>>
>>(Including Steven in recipients)
>>>
>>>Sent from my iPhone
>>>
>>>
>>>On 2013/04/27, at 19:06, Remko Popma  wrote:
>>>
>>>> Two more things:
>>>>
>>>> disruptor 3.0.1 is fine.
>>>>
>>>> Your layout pattern doesn't actually use location, so if you use Async 
>>>> (Logger or Appender) I'd recommend you set includeLocation=false for 
>>>> better performance.
>>>>
>>>> Remko
>>>>
>>>> Sent from my iPhone
>>>>
>>>

Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy

2013-04-29 Thread Remko Popma
Imesh,

It is hard to see what could be the problem based on your description.
I created this JIRA ticket for the issue you describe:
https://issues.apache.org/jira/browse/LOG4J2-228


Would it be possible for you to attach a test program that demonstrates the 
issue to that JIRA ticket?

Kind regards,
Remko



 From: Imesh Damith 
To: log4j-user@logging.apache.org 
Sent: Monday, April 29, 2013 3:47 PM
Subject: Re: Log4j2 UDP socket configure error. Class not found 
org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
 

Hi All,

Reminding !!, Can anyone help me please?


Regards,
Imesh

On Wednesday 10 April 2013 04:15 PM, Imesh Damith wrote:
> Hi,
>
> I'm trying to use UDP server to log my messages. For this I use LOG4J2.
> But I got below error in the server side.
>
> ClassNotFoundException Error : java.lang.ClassNotFoundException:
> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>
>
> Below is my server side code.
>
>
> ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
> ObjectInputStream obj = new ObjectInputStream(bis);
> LogEvent logEvent = (LogEvent) obj.readObject();
>
> System.out.println(logEvent.toString());
>
>
> Below is my pom.xml file dependency.
>
> 
> org.apache.logging.log4j
> log4j-api
> 2.0-beta4
> 
> 
> org.apache.logging.log4j
> log4j-core
> 2.0-beta4
> 
>
>
>
>
> Thanks in advance,
> Imesh


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy

2013-04-29 Thread Remko Popma
Hi Imesh,

I'll take a look, thank you. 
I'll attach the files to the Jira when I get home.

About Jira, I think anyone can create an account. Maybe for next time... :-)

Remko

Sent from my iPhone

On 2013/04/30, at 14:40, Imesh Damith  wrote:

> Hi Remko,
> 
> Sorry, I do not have access to your JIRA. (User name pwd).
> 
> Here with I have attached relevant files. My whole program needs to configure 
> but within these classes you should be able to understand.
> 
> 
> client code (Logs_test.java class) send the debug log and TCPServer_test.java 
> class receive it.  
> 
> But there is an error catching in line 111 ( class not found). 
> 
> 
> 
> Let me know if I miss any jar file. My pom.xml file also attached.
> 
> 
> Regards,
> Imesh
> 
> 
> On Monday 29 April 2013 05:12 PM, Remko Popma wrote:
>> 
>> Imesh,
>> 
>> It is hard to see what could be the problem based on your description.
>> I created this JIRA ticket for the issue you describe:
>> https://issues.apache.org/jira/browse/LOG4J2-228
>> 
>> 
>> Would it be possible for you to attach a test program that demonstrates the 
>> issue to that JIRA ticket?
>> 
>> Kind regards,
>> Remko
>> 
>> 
>> 
>>  From: Imesh Damith 
>> To: log4j-user@logging.apache.org 
>> Sent: Monday, April 29, 2013 3:47 PM
>> Subject: Re: Log4j2 UDP socket configure error. Class not found 
>> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>  
>> 
>> Hi All,
>> 
>> Reminding !!, Can anyone help me please?
>> 
>> 
>> Regards,
>> Imesh
>> 
>> On Wednesday 10 April 2013 04:15 PM, Imesh Damith wrote:
>>> Hi,
>>> 
>>> I'm trying to use UDP server to log my messages. For this I use LOG4J2.
>>> But I got below error in the server side.
>>> 
>>> ClassNotFoundException Error : java.lang.ClassNotFoundException:
>>> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>> 
>>> 
>>> Below is my server side code.
>>> 
>>> 
>>> ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
>>> ObjectInputStream obj = new ObjectInputStream(bis);
>>> LogEvent logEvent = (LogEvent) obj.readObject();
>>> 
>>> System.out.println(logEvent.toString());
>>> 
>>> 
>>> Below is my pom.xml file dependency.
>>> 
>>> 
>>> org.apache.logging.log4j
>>> log4j-api
>>> 2.0-beta4
>>> 
>>> 
>>> org.apache.logging.log4j
>>> log4j-core
>>> 2.0-beta4
>>> 
>>> 
>>> 
>>> 
>>> 
>>> Thanks in advance,
>>> Imesh
>> 
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> 
> 
> 
> 


Re: Custom Converter plugin won't load.

2013-05-01 Thread Remko Popma
Hi John,

I don't have an immediate answer for you, but
I've created JIRA LOG4J2-232 to track this issue.

(Have you tried removing the trailing comma in 
packages="com.xxx.log4j.converters,">

in the log4j2.xml config?)

Remko



 From: John Smith 
To: log4j-user@logging.apache.org 
Sent: Thursday, May 2, 2013 5:41 AM
Subject: Custom Converter plugin won't load.
 

Using log4j2-beta5

I'm writing a custom PatternConverter to mask logs for such things as
Credit Card and Card Security Code and some additional elements.

My converter looks like so

package com.xxx.log4j.converters;

import java.util.List;
import java.util.regex.Pattern;

import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.layout.PatternLayout;
import org.apache.logging.log4j.core.pattern.ConverterKeys;
import org.apache.logging.log4j.core.pattern.LogEventPatternConverter;
import org.apache.logging.log4j.core.pattern.PatternFormatter;
import org.apache.logging.log4j.core.pattern.PatternParser;

@Plugin(name = "MaskConverter", type = "Converter")
@ConverterKeys({"ma", "mask" })
public class MaskConverter extends LogEventPatternConverter  {

private final List formatters;
private final Pattern ccPattern;
private final Pattern cvnPattern;

public static final String CARD_PATTERN =
"(AcctNumber|AcctNumber2)([=\\^])([0-9]+)([0-9]{4})";
public static final String CARD_MASK = "$1$2$4";
public static final String CVN_PATTERN = "(Cvn)([=\\^])([0-9]{3,4})";
public static final String CVN_MASK = "$1$2";

    private MaskConverter(final List formatters, final
Pattern ccPattern, final Pattern cvnPattern) {
        super("ma", "mask");

        System.out.println("Here...");

        this.formatters = formatters;
        this.ccPattern = ccPattern;
        this.cvnPattern = cvnPattern;
    }

    public static MaskConverter newInstance(final Configuration config,
final String[] options) {

        System.out.println("There...");

    if (options.length != 1) {
            LOGGER.error("Incorrect number of options on mask. Expected 1
received " + options.length);
            return null;
        }

        final Pattern ccPattern = Pattern.compile(CARD_PATTERN,
Pattern.CASE_INSENSITIVE);
        final Pattern cvnPattern = Pattern.compile(CVN_PATTERN,
Pattern.CASE_INSENSITIVE);

        final PatternParser parser =
PatternLayout.createPatternParser(config);
        final List formatters = parser.parse(options[0]);
        return new MaskConverter(formatters, ccPattern, cvnPattern);
    }

@Override
public void format(final LogEvent event, final StringBuilder toAppendTo) {

        System.out.println("Where..." + event.getMessage());
final StringBuilder buf = new StringBuilder();

for (final PatternFormatter formatter : formatters) {
            formatter.format(event, buf);
        }


toAppendTo.append(ccPattern.matcher(cvnPattern.matcher(buf.toString()).replaceAll(CVN_MASK)).replaceAll(CARD_MASK));
}
}

And my log4j2.xml looks like...




















But it doesn't seem to load the plugin I don't see any of my print
statements in the console and all I see is the word ask appended to my log
messages.

Have I missed something

Re: Log4j2 UDP socket configure error. Class not found org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy

2013-05-02 Thread Remko Popma
Imesh,
Does the server-side code (the process that is receiving UDP messages) have 
both the log4j-api and the log4j-core jar files in the classpath?

I've attached your files to the Jira ticket. Would you mind if we follow up on 
this issue by commenting on Jira?

https://issues.apache.org/jira/browse/LOG4J2-228


Sent from my iPhone

On 2013/04/30, at 14:46, Imesh Damith  wrote:

> Hi Gary,
> 
> This is happening in while running. In my TCP server class. below is snipt.
> 
> private void someMethod() throws IOException{
>DatagramSocket socket = new DatagramSocket(9092);
> 
> 
>byte[] buf = new byte[10];
>DatagramPacket packet = new DatagramPacket(buf, buf.length);
> 
>socket.receive(packet);
> 
>ReadPacket(packet.getData());
> 
> }
> public static String ReadPacket(byte[] recievedPakets){
> 
> 
>String retvals = "";
>ByteArrayInputStream bis = new ByteArrayInputStream(recievedPakets);
> 
>LogEvent logEvent = null;
>ObjectInputStream obj = null;
>try {
> 
>bis = new ByteArrayInputStream(recievedPakets);
>obj = new ObjectInputStream(bis);
>logEvent = (LogEvent) obj.readObject();
>System.out.println(logEvent.toString());
> 
> 
>} catch (IOException e1) {
>System.out.println(" IOException Error : "+e1);
>e1.printStackTrace();
>} catch (ClassNotFoundException e1) {
>System.out.println(" ClassNotFoundException Error : "+e1);
>e1.printStackTrace();
> 
> 
> 
> 
>}finally{
>try {bis.close(); } catch (Exception e2) {}
> 
>}
> 
>return retvals;
> 
>}
> 
> 
> 
> 
> Thanks,
> Imesh
> 
> On Monday 29 April 2013 05:20 PM, Gary Gregory wrote:
>> Does the error happen from maven or your IDE?
>> 
>> Gary
>> 
>> On Apr 29, 2013, at 7:43, Remko Popma  wrote:
>> 
>>> Imesh,
>>> 
>>> It is hard to see what could be the problem based on your description.
>>> I created this JIRA ticket for the issue you describe:
>>> https://issues.apache.org/jira/browse/LOG4J2-228
>>> 
>>> 
>>> Would it be possible for you to attach a test program that demonstrates the 
>>> issue to that JIRA ticket?
>>> 
>>> Kind regards,
>>> Remko
>>> 
>>> 
>>> 
>>> From: Imesh Damith
>>> To: log4j-user@logging.apache.org
>>> Sent: Monday, April 29, 2013 3:47 PM
>>> Subject: Re: Log4j2 UDP socket configure error. Class not found 
>>> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>> 
>>> 
>>> Hi All,
>>> 
>>> Reminding !!, Can anyone help me please?
>>> 
>>> 
>>> Regards,
>>> Imesh
>>> 
>>> On Wednesday 10 April 2013 04:15 PM, Imesh Damith wrote:
>>>> Hi,
>>>> 
>>>> I'm trying to use UDP server to log my messages. For this I use LOG4J2.
>>>> But I got below error in the server side.
>>>> 
>>>> ClassNotFoundException Error : java.lang.ClassNotFoundException:
>>>> org.apache.logging.log4j.core.impl.Log4jLogEvent$LogEventProxy
>>>> 
>>>> 
>>>> Below is my server side code.
>>>> 
>>>> 
>>>> ByteArrayInputStream bis = new ByteArrayInputStream(packet.getData());
>>>> ObjectInputStream obj = new ObjectInputStream(bis);
>>>> LogEvent logEvent = (LogEvent) obj.readObject();
>>>> 
>>>> System.out.println(logEvent.toString());
>>>> 
>>>> 
>>>> Below is my pom.xml file dependency.
>>>> 
>>>> 
>>>> org.apache.logging.log4j
>>>> log4j-api
>>>> 2.0-beta4
>>>> 
>>>> 
>>>> org.apache.logging.log4j
>>>> log4j-core
>>>> 2.0-beta4
>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> Thanks in advance,
>>>> Imesh
>>> 
>>> -
>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 


Re: Two problems with SMTPAppender

2013-05-09 Thread Remko Popma
Matej,

The docs may not be clear on this, but i believe this buffer is essentially for 
multithreaded access. 

Every event will be stored in the buffer, and then trigger a send(). You are 
right that sending happens in the calling thread. You could consider wrapping 
the smtp appender in an async appender. 

When a send happens, it will grab all events currently in the buffer and send 
them in a single email. 

I believe this is correct behavior. Otherwise you may only have one ERROR and 
the email never gets sent because the appender is waiting for 9 more events...

Best regards,
Remko

Sent from my iPhone

On 2013/05/09, at 21:32, Matej Vitásek  wrote:

> Hi all,
> 
> I'd like to report 2 problems I am encountering using the SMTPAppender. I
> am using it* to send me mails whenever an ERROR is logged in a web
> application.
> 
> 1) Buffer size is ignored. Excerpt from my log4j2.xml:
>  to="..." from="..." smtpHost="smtp.gmail.com"
> smtpPort="465" *bufferSize="10"* smtpProtocol="smtps" smtpUsername="..."
> smtpPassword="...">
> 
> 
> You will notice that the buffer size is 10. I'd expect to be getting
> e-mails with 10 errors aggregated, but every e-mail always contains only
> one error.
> 
> Looking into SMTPAppender.append() I see a call to manager.sendEvents()
> which does not aggregate the message - it just sends it. To me it seems
> that append() should write into SMTPManager.buffer and send only if it's
> full...
> 
> 2) Sending the e-mail blocks the thread that logged the error. I don't know
> how to "prove" this empirically, it's just a really clear subjective
> feeling: whenever an error gets logged, the whole application just lags for
> the time it takes to send the mail.
> 
> Can I provide you some help in pinpointing this problem?
> 
> 
> Overall: just ask if you need more information,
> 
> 
> Thanks!
> 
> 
> Matej

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Two problems with SMTPAppender

2013-05-10 Thread Remko Popma
Matej,

Suppose you have 3 threads that all log an error at exactly the same time. 
They all call isFiltered at the same time, and all events are added to the 
buffer before any thread had a chance to call the append method. 
Now all three threads will call the append method. The first time, 3 events are 
grabbed from the buffer (leaving the buffer empty), and all events are put into 
a single email which is sent immediately. 
When the second thread calls append, the buffer is empty and no mail is sent. 
Same for thread#3. 
(Hmm... This may be a bug? Currently the code does not check if the array 
obtained from the buffer is empty and will send an empty email in this case... )

Anyway, I think the above flow was the intention. 

I understand your request now: you want multiple log events to be collected 
into a single email if they arrive within some time window of the first event. 
Makes sense. Can you raise a Jira ticket for that?

About your second issue, you can wrap the smtp appender in an async appender so 
your app is not delayed by the network I/O. 
See the docs for AsynchAppender. 
(Note that this appender is renamed to AsyncAppender in beta6 which just came 
out.)


Sent from my iPhone

On 2013/05/10, at 15:56, Matej Vitásek  wrote:

> Remko,
> 
> Thanks for the answer. After looking into the sources some more I found
> this:
> 
>   - SMTPAppender.append(), which seems to be the usual way of events being
>   logged to this appender, sends the mail directly.
>   - SMTPAppender.isFiltered(), which is an overriding of the usual logic
>   "filtered => do not log", instead collects the events in the cyclic buffer.
> 
> To be honest, I am quite confused with this behavior. Could you perhaps
> shed some light on it?
> 
> Regarding buffering mails and having 1 error not sent for a long time: I
> see your point, there can be perhaps a timeout setting.
> 
> Rationale: way too often, errors are clustered together. More often than
> not, my app will send a barrage of error mails, and then be quiet for a
> while. Even a timeout of 1 second would decrease the mail traffic
> substantially, without losing any information.
> 
> What is your opinion of my second problem, the app being blocked while the
> mail is being sent?
> 
> Thanks!
> 
> 
> Matej
> 
> 
> 
> On Thu, May 9, 2013 at 2:48 PM, Remko Popma  wrote:
> 
>> Matej,
>> 
>> The docs may not be clear on this, but i believe this buffer is
>> essentially for multithreaded access.
>> 
>> Every event will be stored in the buffer, and then trigger a send(). You
>> are right that sending happens in the calling thread. You could consider
>> wrapping the smtp appender in an async appender.
>> 
>> When a send happens, it will grab all events currently in the buffer and
>> send them in a single email.
>> 
>> I believe this is correct behavior. Otherwise you may only have one ERROR
>> and the email never gets sent because the appender is waiting for 9 more
>> events...
>> 
>> Best regards,
>> Remko
>> 
>> Sent from my iPhone
>> 
>> On 2013/05/09, at 21:32, Matej Vitásek  wrote:
>> 
>>> Hi all,
>>> 
>>> I'd like to report 2 problems I am encountering using the SMTPAppender. I
>>> am using it* to send me mails whenever an ERROR is logged in a web
>>> application.
>>> 
>>> 1) Buffer size is ignored. Excerpt from my log4j2.xml:
>>> >> to="..." from="..." smtpHost="smtp.gmail.com"
>>> smtpPort="465" *bufferSize="10"* smtpProtocol="smtps" smtpUsername="..."
>>> smtpPassword="...">
>>> 
>>> 
>>> You will notice that the buffer size is 10. I'd expect to be getting
>>> e-mails with 10 errors aggregated, but every e-mail always contains only
>>> one error.
>>> 
>>> Looking into SMTPAppender.append() I see a call to manager.sendEvents()
>>> which does not aggregate the message - it just sends it. To me it seems
>>> that append() should write into SMTPManager.buffer and send only if it's
>>> full...
>>> 
>>> 2) Sending the e-mail blocks the thread that logged the error. I don't
>> know
>>> how to "prove" this empirically, it's just a really clear subjective
>>> feeling: whenever an error gets logged, the whole application just lags
>> for
>>> the time it takes to send the mail.
>>> 
>>> Can I provide you some help in pinpointing this problem?
>>> 
>>> 
>>> Overall: just ask if you need more information,
>>> 
>>> 
>>> Thanks!
>>> 
>>> 
>>> Matej
>> 
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>> 
>> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: [ANNOUNCEMENT] Welcome Nick Williams

2013-05-11 Thread Remko Popma
Welcome to the team, Nick!

-Remko

Sent from my iPhone

On 2013/05/11, at 13:53, Christian Grobmeier  wrote:

> Hi,
> 
> it is my pleasure to announce to the community
> that Nick Williams has joined our ranks.
> 
> He made remarkable contributions to log4j 2
> and we all believe he is a valuable member
> of Apache Logging Services now and in future.
> 
> Kind regards,
> Christian
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Convient way to specify Log4J2 configuration outside of webapp?

2013-05-13 Thread Remko Popma
By default Log4j looks for log4j2.xml in the classpath, but you can also 
specify system property
-Dlog4j.configurationFile=path/to/log4j2.xml

or even in your code:
System.setProperty(XMLConfigurationFactory.CONFIGURATION_FILE_PROPERTY, 
"path/to/log4j2.xml");




 From: Jason B 
To: log4j-user@logging.apache.org 
Sent: Tuesday, May 14, 2013 1:32 AM
Subject: Convient way to specify Log4J2 configuration outside of webapp?
 

Hello,

I'm wondering if there is a convenient way to configure Log4J2 logging
without having it inside of our resources directory.  I don't want to use
symbolic links, as that has the potential of introducing security holes
into our platform.

We're looking into other options such as specifying file locations, but the
documentation is incomplete or does not apply to our unique solution.

Could some light be shed on this?

Thanks,

Jason Black

Re: Need help: Steps in your INSTALL doc failing

2013-05-13 Thread Remko Popma
Mary,

Gary was referring to log4j-2.0. While generally more awesome (ahem), it does 
need those 2 jars to run. 

You seem to be using log4j-1.2. 
Then you should only need the one jar. 
You also need a log4j.properties or log4j.xml file in a directory that is in 
the classpath. The site should have some sample config files. 

In your code, I don't think you need to call BasicConfigurator.configure();
I think you can safely remove that line; log4j will pick up your config file 
from the classpath. 

Sent from my iPhone

On 2013/05/14, at 10:30, Mary Laude  wrote:

> Hey -  thanks for the quick reply!  Ya know, I read that bit
> but the jar file I have is named log4j-1.2-17.jar, and I thought
> it comprised everything.  When I downloaded the code, that's
> the only jar file there was.  Clearly, I was delusional!  I'll go
> look for the corresponding API and core jar files...
> Thanks again!
> 
> 
> 
> On Mon, May 13, 2013 at 6:00 PM, Gary Gregory wrote:
> 
>> You need the API and core jar files on your classpath for compilation
>> and runtime.
>> 
>> Gary
>> 
>> On May 13, 2013, at 20:46, Mary Laude  wrote:
>> 
>>> Hello -
>>> 
>>> I can write, compile, and successfully run a Java program
>>> to look at a .jar file and list the classes defined therein, but
>>> I can't for the life of me get your "Using log4j" java code shown
>>> in 1-2.17's INSTALL doc to work.
>>> 
>>> Perhaps there's some other magic that needs to happen to get
>>> this code snippet you wrote to yield output?
>> 
>>> You can now test your installation by first compiling the following
>>>  simple program.
>>> 
>>>   import org.apache.log4j.Logger;
>>>   import org.apache.log4j.BasicConfigurator;
>>> 
>>>   public class Hello {
>>> 
>>> private static final Logger logger = Logger.getLogger(Hello.class);
>>> 
>>> public
>>> static
>>> void main(String argv[]) {
>>>   BasicConfigurator.configure();
>>>   logger.debug("Hello world.");
>>>   logger.info("What a beatiful day.");
>>> }
>>>   }
>> -
>>> I understand how CLASSPATH works, etc.  I can get it to compile but
>>> even if I again (with option -cp) specify exactly where the .class file
>> is
>>> that it just created from the compile, it still can't find what it needs.
>>> 
>>> Depending on where I've put things and what I tell it, I get one of these
>>> failing results when I try to run the executable:
>>> 
>>> (1)
>>> java.lang.NoClassDefFoundError: org/apache/log4j/Logger
>>>   at Hello.(Hello.java:6)
>>> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
>>>   at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>>>   at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>>>   at java.security.AccessController.doPrivileged(Native Method)
>>>   at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>>>   at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
>>>   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>>   at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>>>   ... 1 more
>>> Exception in thread "main"
>>> 
>>> or (2)
>>> Error: Could not find or load main class Hello
>>> 
>>> 
>>> Please, I am an old UNIX geek but this is really really frustrating me.
>>> I have looked literally EVERYWHERE to find out what the problem is
>>> but of course I am apparently the first and only person to ever have this
>>> problem.  Ha!
>>> 
>>> 
>>> --
>>> Please test what you build.
>> 
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> 
> -- 
> Please test what you build.

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Need help: Steps in your INSTALL doc failing

2013-05-13 Thread Remko Popma
Mary,
If you decide to try log4j-2.0 (heartily recommended), the config file name 
should be log4j2.xml. 

The 2.0 site also has many example configs in the manual pages. 

And we'd love your feedback. :-)

Remko

Sent from my iPhone

On 2013/05/14, at 10:44, Gary Gregory  wrote:

> Yes, sorry about that, I am in 2.0 mode.
> 
> Gary
> 
> On May 13, 2013, at 21:41, Remko Popma  wrote:
> 
>> Mary,
>> 
>> Gary was referring to log4j-2.0. While generally more awesome (ahem), it 
>> does need those 2 jars to run.
>> 
>> You seem to be using log4j-1.2.
>> Then you should only need the one jar.
>> You also need a log4j.properties or log4j.xml file in a directory that is in 
>> the classpath. The site should have some sample config files.
>> 
>> In your code, I don't think you need to call BasicConfigurator.configure();
>> I think you can safely remove that line; log4j will pick up your config file 
>> from the classpath.
>> 
>> Sent from my iPhone
>> 
>> On 2013/05/14, at 10:30, Mary Laude  wrote:
>> 
>>> Hey -  thanks for the quick reply!  Ya know, I read that bit
>>> but the jar file I have is named log4j-1.2-17.jar, and I thought
>>> it comprised everything.  When I downloaded the code, that's
>>> the only jar file there was.  Clearly, I was delusional!  I'll go
>>> look for the corresponding API and core jar files...
>>> Thanks again!
>>> 
>>> 
>>> 
>>> On Mon, May 13, 2013 at 6:00 PM, Gary Gregory wrote:
>>> 
>>>> You need the API and core jar files on your classpath for compilation
>>>> and runtime.
>>>> 
>>>> Gary
>>>> 
>>>> On May 13, 2013, at 20:46, Mary Laude  wrote:
>>>> 
>>>>> Hello -
>>>>> 
>>>>> I can write, compile, and successfully run a Java program
>>>>> to look at a .jar file and list the classes defined therein, but
>>>>> I can't for the life of me get your "Using log4j" java code shown
>>>>> in 1-2.17's INSTALL doc to work.
>>>>> 
>>>>> Perhaps there's some other magic that needs to happen to get
>>>>> this code snippet you wrote to yield output?
>>>> 
>>>>> You can now test your installation by first compiling the following
>>>>> simple program.
>>>>> 
>>>>> import org.apache.log4j.Logger;
>>>>> import org.apache.log4j.BasicConfigurator;
>>>>> 
>>>>> public class Hello {
>>>>> 
>>>>>   private static final Logger logger = Logger.getLogger(Hello.class);
>>>>> 
>>>>>   public
>>>>>   static
>>>>>   void main(String argv[]) {
>>>>> BasicConfigurator.configure();
>>>>> logger.debug("Hello world.");
>>>>> logger.info("What a beatiful day.");
>>>>>   }
>>>>> }
>>>> -
>>>>> I understand how CLASSPATH works, etc.  I can get it to compile but
>>>>> even if I again (with option -cp) specify exactly where the .class file
>>>> is
>>>>> that it just created from the compile, it still can't find what it needs.
>>>>> 
>>>>> Depending on where I've put things and what I tell it, I get one of these
>>>>> failing results when I try to run the executable:
>>>>> 
>>>>> (1)
>>>>> java.lang.NoClassDefFoundError: org/apache/log4j/Logger
>>>>> at Hello.(Hello.java:6)
>>>>> Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
>>>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
>>>>> at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
>>>>> at java.security.AccessController.doPrivileged(Native Method)
>>>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
>>>>> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
>>>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
>>>>> ... 1 more
>>>>> Exception in thread "main"
>>>>> 
>>>>&g

Re: how to configure log4j (1.2) in JBoss 6?

2013-05-22 Thread Remko Popma
Piers,

To be honest, this sounds more like a question that should be directed to the 
JBoss people...

Kind regards,
Remko

Sent from my iPhone

On 2013/05/20, at 22:45, Piers Uso Walter  wrote:

> Hi,
> 
> I am migrating an application from JBoss 4 to JBoss 6 and stumble over the 
> fact that log4j does not seem to be supported by JBoss 6 out of the box any 
> more.
> 
> I've researched this quite extensively on the web, but have only found 
> questions from other people, no answers. I hope someone in the log4j 
> community has successfully used log4j (1.2) with JBoss 6 and might be able to 
> help.
> 
> 
> Our previous setup with a log4j.xml configuration file in 
> server/default/conf/ no longer works. That configuration files does not seem 
> to be detected and used by JBoss 6.
> Basic logging (as configured in server/default/deploy/jboss-logging.xml) 
> works, but I have not been successful in configuring log4j appenders in that 
> file. From what I understand, this file does not really configure log4j, as 
> JBoss 6 uses a new logging mechanism.
> 
> For example, I've modified jboss-logging.xml to use a log4j console appender 
> and a log4j file appender instead of the standard appenders (see attached 
> file). This did not work. The log file ${jboss.server.log.dir}/log4j.log is 
> not created, the console log stays at level INFO (instead of DEBUG).
> 
> What would I have to do in order to get JBoss 6 to use log4j for my 
> applications?
> One requirement we have is to store the log4j configuration in a central file 
> and not within the application packages (because for debugging purposes we 
> ask our customers to modify the configuration).
> 
> I'm using JBoss 6.1 final, in case that makes a difference.
> 
> Thanks a lot
> Piers
> 
> -- 
> Piers Uso Walter 
> ilink Kommunikationssysteme GmbH
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: How do I add a prefix to log4j messages (at the object level)

2013-05-27 Thread Remko Popma

On 2013/05/27, at 23:50, Lucie Boubée  wrote:

> Hi,
> 
> I use log4j2 beta 6 and I would like to add a prefix to all my messages.
> This prefix is passed to the constructor parameter and it depends on the
> instance of the class. So we're at the object level (not class or thread).
> 
> For example, I have an A class instantiated like new A(152), so when I use
> log.error("message") on this class, 152: is written just before the
> message. For new A(155),155: will be displayed instead.

Do you mean that the call to log.error("message") is inside class A?
In that case, how about simply using
log.error("{} message", myPrefix);
Would that work?

> 
> I try to use ThreadContext.put on the constructor but, I don't know when
> logger wiil be call consequently the prefix is set to the last
> ThreadContext called but that does not necessarily correspond to the
> correct class instance
> I ask to stackoverflow (
> http://stackoverflow.com/questions/16723016/how-do-i-add-a-prefix-to-log4j-messages-at-the-object-level)
> but
> it has not solved my problem.
> 
> -- 
> Lucie

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: [Log4j2] How to change the appender file name at run time

2013-07-21 Thread Remko Popma
You can use the RoutingAppender. 
Take a look at the last comment (source & config example) in this Jira ticket:
https://issues.apache.org/jira/browse/LOG4J2-314


Sent from my iPhone

On 2013/07/22, at 12:38, levtbinh  wrote:

> In my application, I would want to save log of different sources to different
> files without knowing the file names before hand.
> 
> How should I do that with Log4j2?
> 
> I have tried the following config
> 


Re: Confused: want low latency: do I need BOTH async logger AND async appender??

2013-07-23 Thread Remko Popma
Curt,

Without knowing your app & env characteristics, I'd say that looks fine. The 
ring buffer won't grow, so if you get bursts larger than 128 log events you 
will see latency going up as logging will become IO bound when the ring buffer 
is full. 

Otherwise all seems reasonable. 
Let me know if you hit any snags.

Regards,
Remko

Sent from my iPhone

On 2013/07/24, at 0:39, "SMITH, CURTIS"  wrote:

> http://logging.apache.org/log4j/2.x/manual/async.html
> 
> This URL describes that v2 has both async logger and async appender.   What 
> is the suggested config for an embedded situation where I want low latency, 
> nothing fancy?
> 
> I've had do this in code since we don't own the cmd line:  OSGi and system 
> vendor owns the box and java command line.
> 
> System.setProperty("AsyncLoggerContextSelector", 
> "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
> System.setProperty("AsyncLogger.RingBufferSize", "128");// min size 
> permissable to keep memory low
> System.setProperty("AsyncLogger.WaitStrategy", "Block");// less CPU, 
> better for embedded env
> System.setProperty("log4j2.disable.jmx", "true");   // saves on a 
> jmx jar and we don't use JMX anyway
> 
> Tnx curt
> 
> Curt Smith
> AT&T Digital Life
> DLC Software Development
> 404-499-7013
> (cell) 678-365-6508
> 
> 
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Not getting my log output, need debugging v2 tips?

2013-07-23 Thread Remko Popma
You did switch on AsyncLoggers using the context selector?
One reason you may not see FastFile output is if the buffer is not being 
flushed.
AsyncLoggers auto-flush so this should not happen but since you're not seeing 
output...

Several things to try: 
* in the FastRollingFile appender config, try setting immediateFlush="true", 
just to see if you now get output
* change your configuration element to add level=TRACE:  and see if the AsyncLoggers are being started correctly.
  you should see "Starting AsyncLogger disruptor with ringbuffer size {}..."

Remko



 From: "SMITH, CURTIS" 
To: "log4j-user@logging.apache.org"  
Sent: Wednesday, July 24, 2013 6:37 AM
Subject: Not getting my log output, need debugging v2 tips?
 

I feel apologetic for asking how to debug a v2 configuration but there's no 
links off the v2 website.  My env is embedded and I'm not getting any missing 
classpath problems, I solved those.  I am getting console output but none of my 
FastRollingFile appenders are emitting their logs.

Some of my problem may have been translating my v1 log4j.properties into the v2 
equivalent.

Maybe I need to create a logger for the log4j packages to the console appender? 
 I attempted that.  See highlighted logger:

log4j.logger.com.att.dlc.afm=DEBUG,DEVICES,ERRORLOG
log4j.additivity.com.att.dlc.afm=false

log4j.logger.com.att.dlc.devices=DEBUG,DEVICES,ERRORLOG
log4j.additivity.com.att.dlc.devices=false

log4j.logger.com.att.dlc.util.serialport=DEBUG,DEVICES,ERRORLOG
log4j.additivity.com.att.dlc.util.serialport=false

log4j.logger.com.att.dlc.webcamserver=DEBUG,VIDEO,ERRORLOG
log4j.additivity.com.att.dlc.webcamserver=false

log4j.logger.com.att.dlc.devices.cameras=DEBUG,VIDEO,ERRORLOG
log4j.additivity.com.att.dlc.devices.cameras=false




        
                
                        
                                
[%d][%-5p][%-15t][%-15c{1}]:%m%n
                        
                        
                                
                        
                        
                
                
                        
                                
[%d][%-5p][%-15t][%-15c{1}]:%m%n
                        
                        
                                
                        
                        
                
                
                        
                                
[%d][%-5p][%-15t][%-15c{1}]:%m%n
                        
                        
                                
                        
                        
                
                
                        
                
        
        
                
                        
                
                
                        
                
                
                        
                
                
                        
                
                
                        
                
                
                        
                
                
                        
                
        


Curt Smith
AT&T Digital Life
DLC Software Development
404-499-7013
(cell) 678-365-6508

Re: async logger on slow single core env performs 50% worse than log4j v1

2013-07-26 Thread Remko Popma
I don't think we've ever done any performance testing on the kind of 
environment you describe, so this is great feedback, thanks!

First, configuration via XML instead of sys props is on the todo list.

Second, you mentioned you use system property "AsyncLoggerContextSelector" to 
switch on AsyncLoggers.
This is incorrect. The correct key is "Log4jContextSelector" (and that would 
explain why removing this setting made no difference).

Third, if I understand correctly you are essentially logging to a memory-mapped 
file. In that case any buffering is just wasting CPU resources, so you should 
not use the Fast*File appenders as their buffering cannot be switched off. 
(Non-Fast) FileAppenders also use bufferedIO=true by default, but you can 
switch this off in config. I would expect this to save some CPU.

On that note, you mentioned CPU usage as your performance measure. Is that the 
most important number? Do you have any throughput/latency goals?
Do you have any tools on your platform to see what the CPU is doing? Which 
threads are busy for example?

In terms of GC, making all loggers Async has a small benefit in that it re-uses 
log event objects.


I am still intrigued by the difference in CPU usage you mention between 
log4j-1.2 and 2.0. Is your application code exactly the same? Or do you use the 
pattern formats that are now available in log4j-2.0?

Regards,
Remko



 From: "SMITH, CURTIS" 
To: Log4J Users List  
Sent: Saturday, July 27, 2013 6:55 AM
Subject: RE: async logger on slow single core env performs 50% worse than log4j 
v1
 

LOL well that's obvious now.  :)  It was more a case of wishful thinking and 
why not give it a "try".    But it's still odd that my attempts to slim it down 
It's still 2x worse than v1.  Something else is in play.

curt

-Original Message-
From: Ralph Goers [mailto:ralph.go...@dslextreme.com] 
Sent: Friday, July 26, 2013 5:34 PM
To: Log4J Users List
Subject: Re: async logger on slow single core env performs 50% worse than log4j 
v1

I'm curious why you are even trying to use Async anything with a single core 
environment (unless it is hyper-threaded). Only 1 thread can be active at a 
time so when you switch threads the active thread will just stop. This won't 
gain you any additional throughput but you will still incur the additional 
overhead of thread management and locking.

Ralph

On Jul 26, 2013, at 1:55 PM, SMITH, CURTIS wrote:

> I removed  System.setProperty("AsyncLoggerContextSelector", 
> "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
> No change in CPU, but going from FastRollingFile to RollingFile I got back 
> 10% of my lost CPU.  Still at 40% CPU where v1 runs at 20%.
> 
> I would like to get down to the equivalent behavior as we got from log4j v1, 
> then try v2 features to get it better.  Since I'm still seeing worse 
> performance, I'm guessing that there's still one or more threads under the 
> hood vs V1 with:  sync Logger and RollingFile.
> 
> Any guesses for me to try?
> 
> Tnx curt
> 
> _
> From: SMITH, CURTIS
> Sent: Friday, July 26, 2013 1:16 PM
> To: log4j-user@logging.apache.org
> Subject: async logger on slow single core env performs 50% worse than log4j v1
> 
> 
> I suspect a slow single core env is a new scenario for v2 and async logger.   
> My view is that there's a mis match between v2's async logger thread design 
> that works great on multi-core envs and this embedded slow single core env... 
>   Sooo I need to try a few different configurations to see what does run best 
> on a slow single core...
> 
> But I need your tips as to what I might change / tune to get v2 to perform as 
> good or better than v1 in a single core env.
> 
> FWIW:  log4j v1 ran my standard use case test averaging 20% CPU.  Log4j v2 
> ran at 50% CPU, so more than 2x worse.
> 
> Our business logic is highly threaded so any subsystem that has a "hot" 
> thread like this config that has 5 loggers and 3 appenders I might be 
> shooting myself in the foot.  You know this new design the best so I'm open 
> as to what to pick and choose from v2 that is likely to perform the best?
> 
> FYI:  I feel using system properties vs exclusively using declarative 
> configuration all within the log4j2.xml separates out configuration.  I'd 
> prefer to not have to use system properties for any configuration.
> 
> My first experiment will be to remove the async logger property.
> 
> Any thoughts re the FastRollingFile appender or any other tuning that might 
> be better for a single core env.  It's a slow Arm v5 or so, pretty old and 
> lacking the better context switching features of newer chips.  The VM is also 
> slow,  IBM J9 J2ME JDK1.6.   Benchmarking the J9 vs Oracle J2ME, J9 is real 
> slow and poor at thread context switching.  But you get what you pay for, J9 
> is also real cheap.
> 
> **
> **
> Note:  the log files are on /tmp a memory FS in our env.  So

Re: async logger on slow single core env performs 50% worse than log4j v1

2013-07-27 Thread Remko Popma
I quickly reviewed the code and as far as I can tell:
* only the following places in Log4j-2 will create a permanent thread in 
addition to your application threads: AsyncLoggers, AsyncAppenders, 
o.a.l.l.c.net.SocketServer, o.a.l.l.c.net.UDPSocketServer and 
o.a.l.l.c.helpers.*CachedClock
* synchronous logging will not create any threads
* RollingFile creates a short-lived thread for the roll-over, *only* if the old 
file needs to be compressed to a .zip or .gz file (the file rename action is 
synchronous)

So I'm thinking that the difference in CPU usage is caused by something other 
than threads or async logging.
I'd be interested in your answers to my questions below.

Best regards,
Remko


____
 From: Remko Popma 
To: Log4J Users List  
Sent: Saturday, July 27, 2013 12:53 PM
Subject: Re: async logger on slow single core env performs 50% worse than log4j 
v1
 

I don't think we've ever done any performance testing on the kind of 
environment you describe, so this is great feedback, thanks!

First, configuration via XML instead of sys props is on the todo list.

Second, you mentioned you use system property "AsyncLoggerContextSelector" to 
switch on AsyncLoggers.
This is incorrect. The correct key is "Log4jContextSelector" (and that would 
explain why removing this setting made no difference).

Third, if I understand correctly you are essentially logging to a memory-mapped 
file. In that case any buffering is just wasting CPU resources, so you should 
not use the Fast*File appenders as their buffering cannot be switched off. 
(Non-Fast) FileAppenders also use bufferedIO=true by default, but you can 
switch this off in config. I would expect this to save some CPU.

On that note, you mentioned CPU usage as your performance measure. Is that the 
most important number? Do you have any throughput/latency goals?
Do you have any tools on your platform to see what the CPU is doing? Which 
threads are busy for example?

In terms of GC, making all loggers Async has a small benefit in that it re-uses 
log event objects.


I am still intrigued by the difference in CPU usage you mention between 
log4j-1.2 and 2.0. Is your application code exactly the same? Or do you use the 
pattern formats that are now available in log4j-2.0?

Regards,
Remko



From: "SMITH, CURTIS" 
To: Log4J Users List  
Sent: Saturday, July 27, 2013 6:55 AM
Subject: RE: async logger on slow single core env performs 50% worse than log4j 
v1


LOL well that's obvious now.  :)  It was more a case of wishful thinking and 
why not give it a "try".    But it's still odd that my attempts to slim it down 
It's still 2x worse than v1.  Something else is in play.

curt

-Original Message-
From: Ralph Goers [mailto:ralph.go...@dslextreme.com] 
Sent: Friday, July 26, 2013 5:34 PM
To: Log4J Users List
Subject: Re: async logger on slow single core env performs 50% worse than log4j 
v1

I'm curious why you are even trying to use Async anything with a single core 
environment (unless it is hyper-threaded). Only 1 thread can be active at a 
time so when you switch threads the active thread will just stop. This won't 
gain you any additional throughput but you will still incur the additional 
overhead of thread management and locking.

Ralph

On Jul 26, 2013, at 1:55 PM, SMITH, CURTIS wrote:

> I removed  System.setProperty("AsyncLoggerContextSelector", 
> "org.apache.logging.log4j.core.async.AsyncLoggerContextSelector");
> No change in CPU, but going from FastRollingFile to RollingFile I got back 
> 10% of my lost CPU.  Still at 40% CPU where v1 runs at 20%.
> 
> I would like to get down to the equivalent behavior as we got from log4j v1, 
> then try v2 features to get it better.  Since I'm still seeing worse 
> performance, I'm guessing that there's still one or more threads under the 
> hood vs V1 with:  sync Logger and RollingFile.
> 
> Any guesses for me to try?
> 
> Tnx curt
> 
> _
> From: SMITH, CURTIS
> Sent: Friday, July 26, 2013 1:16 PM
> To: log4j-user@logging.apache.org
> Subject: async logger on slow single core env performs 50% worse than log4j v1
> 
> 
> I suspect a slow single core env is a new scenario for v2 and async logger.   
> My view is that there's a mis match between v2's async logger thread design 
> that works great on multi-core envs and this embedded slow single core env... 
>   Sooo I need to try a few different configurations to see what does run best 
> on a slow single core...
> 
> But I need your tips as to what I might change / tune to get v2 to perform as 
> good or better than v1 in a single core env.
> 
> FWIW:  log4j v1 ran my standard use case test averaging 20% CPU.  Log4j v2 
> ran at 50

Re: async logger on slow single core env performs 50% worse than log4j v1

2013-07-29 Thread Remko Popma
Hang on! By fish tagging do you mean you use logger#entry, #exit, #catching?

These methods walk the stack trace to determine the location (class, method) 
which will give you a *huge* performance penalty! If you're using async 
logging this is 20x slower, for sync logging (slower to begin with) it'll 
be 5x slower. At least these are the numbers I got on enterprise server 
hardware, but I can't imagine this improving on embedded HW...

MDC has been improved in 2.0-beta7 with a copy-on-write impl and should not be 
much overhead anymore. 

The quickest way to test the performance impact of fish tagging is by 
specifying a pattern that does not have location symbols. 
(http://logging.apache.org/log4j/2.x/manual/layouts.html#LocationInformation)

I suspect you'll see a large improvement. 
You may need to replace logger.entry/exit with logger.trace("entered 
methodX")...


Re: v2.0-beta7: Logging causes java.lang.OutOfMemoryError: Java heap space

2013-07-29 Thread Remko Popma
Federico,

Thanks for the report! Would you mind raising a Jira ticket with some 
environment details and if possible steps to reproduce the issue?

Many thanks!
Remko

Re: v2.0-beta7: Logging causes java.lang.OutOfMemoryError: Java heap space

2013-07-29 Thread Remko Popma
Duplicate mail message. Please ignore. Apologies. 

Re: v2.0-beta7: Logging causes java.lang.OutOfMemoryError: Java heap space

2013-07-29 Thread Remko Popma
Federico,

Thanks for the report! Are you on Java 8? Would you mind raising a Jira ticket 
with some environment details and if possible steps to reproduce the issue?

Many thanks!
Remko

Re: Are the custom appenders only like plugins?

2013-07-29 Thread Remko Popma
Aliaksandr,

I don't think you need a specific OSGi version to make a plugin.

Remko



 From: Aliaksandr Belavusau 
To: log4j-user@logging.apache.org 
Sent: Tuesday, July 30, 2013 5:27 AM
Subject: Are the custom appenders only like plugins?
 

Hi Guys,

Trying embed log4j2 in our OSGi application.

So, one small question: How can I create custom appender which will be 
not a plugin? I want to create it like old school log4j1.x appender. The 
cause: We cannot use osgi.core version >= 4.3.0 in our application, only 
=4.2.0. (As you know 4.2.0 does not consist org.osgi.framework.wiring 
package).

Is it possible at all?

Thanks in advance, Alex.


-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org

Re: Are the custom appenders only like plugins?

2013-07-30 Thread Remko Popma
I see... Did you try pre-building the binary file with plugin descriptors using 
the PluginManager main method?

Re: reflection? RE: async logger on slow single core env performs 50% worse than log4j v1

2013-07-30 Thread Remko Popma
It may be possible (but a bit of a hack) to use async loggers without 
reflection. It involves compiling your own version of the
com.lmax.disruptor.util.Util class where you replace the implementation of the 
#getUnsafe() method with a simple call to sun.misc.Unsafe.getUnsafe().
Obviously this is not pretty and there are no guarantees that you won't 
get a SecurityException or so next... :-(

You may be better off using AsyncAppender if you want your blocking I/O to 
happen in another thread. This may still be beneficial even on a one-core 
machine.

Back to the difference between log4j-1.2 (20% CPU) and log4j-2.0 (40% CPU).
Are the test programs identical? I remember you mentioned below that you
use MDC with 2.0 but not with 1.2. Can you give a sample of your log4j
usage with 1.2 and with 2.0? (Maybe create a JIRA and attach files to it?)

Re: Are the custom appenders only like plugins?

2013-07-30 Thread Remko Popma
Sorry for being unclear. I've explained it better in this Jira comment:

https://issues.apache.org/jira/browse/LOG4J2-232?focusedCommentId=13648502&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13648502

Re: use of ThreadContext cleanup vs memory leaks etc

2013-08-01 Thread Remko Popma
Curt,

I think the warning about memory leaks is mostly for short-lived threads. If 
you create a new Thread often, put things in the ThreadContext and then let the 
thread die, things will pile up in the ThreadContext.  If the threads from 
which you do logging essentially live forever then don't worry about it.

ThreadContext has both a stack and a map. Personally I don't see much use for 
the stack, and I only use the map methods:
* put(String, String)
* get(String)
* containsKey(String)
* remove(String)
* isEmpty()

The layout pattern for the map is %X(key) like you said. With the stack you 
only have patterns to display the full stack contents (%x, %NDC).

Since beta7, both the stack and the map are copy-on-write implementations 
(avoiding the need to copy the stack/map for every log event).
There is no ThreadContext#getStack() method, but there are the #getContext() 
and #getImmutableContext() methods.
With the default (copy-on-write) implementations, getContext() creates a copy, 
and getImmutableContext() returns a reference the underlying immutable map.
(That said, I don't see why you would need either of those methods. Just use 
the put/get/remove/... methods on ThreadContext. In my app I only ever need to 
use ThreadContext#put().)

If you find out more about the difference in performance on j2me between log4j 
v1 and v2 I'd be very interested, please keep us posted!

Hope this helps,
Remko



 From: "SMITH, CURTIS" 
To: "log4j-user@logging.apache.org"  
Sent: Thursday, August 1, 2013 10:54 PM
Subject: use of ThreadContext cleanup vs memory leaks etc
 

Greetings,

A terse recap of performance on my J2ME on a slow single core env:  
BasicContextSelector and  BufferedIO=false for RollingFile DOES seem to equal 
log4j v1 performance in my most recent benchmarks.  I'm not comfortable with 
this result because what happened is the V1 benchmarks jumped worse to equal 
the V2 benchmarks without explanation.  So I'm digging into that issue.  But 
I'm wanting to move to using V2's MDC to see if that has much of a perf hit for 
just put'ing a few variables into ThreadContext and referencing them in the 
Pattern:  %X{transID}  etc

The log4j-users-guide.pdf does not have any MDC API discussion, just 
configuration parameters.  This URL is all I've found:  
http://logging.apache.org/log4j/2.x/manual/thread-context.html

Let me start by saying that most threads never die.  They wait on queues so I 
believe I never have to worry about ThreadContext.clear / removeStack etc.   Or 
Do I??

But to clarify proper API use, the above URL infers that thread local object 
storage is cleaned up with ThreadContext.clear()

Maybe it's left over from V1 NDC but the JavaDoc on ThreadContext has some 
strongly worded recommendation for calling ThreadContext.removeStack()

"Each thread that created a diagnostic context by calling 
push(java.lang.String)
 should call this method before exiting. Otherwise, the memory used by the 
thread cannot be reclaimed by the VM.

As this is such an important problem in heavy duty systems and because it is 
difficult to always guarantee that the remove method is called before exiting a 
thread, this method has been augmented to lazily remove references to dead 
threads. In practice, this means that you can be a little sloppy and 
occasionally forget to call 
remove(java.lang.String)
 before exiting a thread. However, you must call remove sometime. If you never 
call it, then your application is sure to run out of memory. "
I could use what the suggested cleanup of ThreadContext is??
Also:  there's no reasoning for the getStack() vs getImutableStack(),  my guess 
is one uses a map.clone() and one doesn't.   I need to bridge the context Map 
around a queue so I do need to get the Map and then put the map elements back 
into the servicing thread's context.  I would like to avoid a map.clone/new Map 
if I can.  Which should I use:  getStack or getImutableStack?

Thanks, curt


Curt Smith
AT&T Digital Life
DLC Software Development
404-499-7013
(cell) 678-365-6508

Re: log4j properties files having Non-English Characters

2013-08-12 Thread Remko Popma
Properties files should not have non-English characters. You need to
convert your file with the native2ascii tool.

More detail:
http://stackoverflow.com/questions/4659929/how-to-use-utf-8-in-resource-properties-with-resourcebundle

Remko

On Monday, August 12, 2013, Jagan kona wrote:

> Hi,
>
> I am using log4j, i am facing small problem when log4j.properties file
> contains non-english characters. Below is the content of properties files,
>
> # Define the root logger with appender file
> log4j.rootLogger = DEBUG, FILE
> # Define the file appender
> log4j.appender.FILE=org.apache.log4j.FileAppender
> log4j.appender.FILE.File=C:\temp\新しいフォルダ\logs\templog4j.log
> # Define the layout for file appender
> log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
> log4j.appender.FILE.layout.conversionPattern=%m%n
>
> when i am using non-english characters in "log4j.appender.FILE.File", then
> i am getting error as log4j api's not able to understand the path, pasted
> below is the error
> log4j:ERROR setFile(null,true) call failed.
> java.io.FileNotFoundException: C:emp??°??≪???logs emplog4j.log
>
> please point if i am doing any wrong in configuration, does log4j support
> properties files stored in UTF-8 format.
>
> Thanks In Advance.
>
> Regards,
> Jagan
>


Re: org.apache.commons.log4j-api or org.apache.logging.log4j-api?

2013-08-14 Thread Remko Popma
I created https://issues.apache.org/jira/browse/LOG4J2-351 to track this
issue.


On Wed, Aug 14, 2013 at 9:21 PM, Aliaksandr Belavusau
wrote:

> It's definitely mistake. Just replace 'commons' with 'logging' in the
> MANIFEST.MF.
>
> Alex.
>
> -Original Message-
> From: Roland [mailto:w...@ids.de]
> Sent: Wednesday, August 14, 2013 3:12 PM
> To: log4j-user@logging.apache.org
> Subject: org.apache.commons.log4j-api or org.apache.logging.log4j-api?
>
> Hi all!
>
> I've noticed that in some manifests the Bundle-Host is defined as
> following:
>
> Fragment-Host: org.apache.commons.log4j-api;version=...
>
> But I can not find org.apache.commons.log4j-api in any maven repository!
>
> Should it be org.apache.*logging*.log4j-api?
>
> Regards
> Roland
>
>
>
>
> --
> View this message in context:
>
> http://apache-logging.6191.n7.nabble.com/org-apache-commons-log4j-api-or-org
> -apache-logging-log4j-api-tp39650.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


Re: log4j2 + FastFileAppender + Tomcat logrotate problem

2013-08-15 Thread Remko Popma
I raised https://issues.apache.org/jira/browse/LOG4J2-354 to track this
issue.
I'll add questions in the comments of that JIRA ticket.

Remko


On Fri, Aug 16, 2013 at 7:17 AM, Kamil Mroczek  wrote:

> Hello,
>
> We decided to try out log4j2-beta8 to see if we could improve our
> logging performance.  We were testing with the disruptor 3.1.1.
> library to make all our appenders async.
>
>
> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
>
> We are running tomcat 7 with Java 1.6.  We use the SLF4J library as well.
>
> The appender that we were using in this case was the Fast File
> Appender with a definition like:
>
>  immediateFlush="false" append="true">
>   
> %m%n
>   
> 
>
> And logger was..
>
> 
>   
> 
>
> So the system was designed to allow log4j to do the logging and then
> have logrotate rotate the log files from the host to an external
> destination.
>
> We rotate the logs every 5 minutes with these params (with LZO
> compression).
>
> compress
> compresscmd /bin/lzop
> compressoptions "-U"
> compressext .lzo
>
> What we were seeing was that after a log rotation happened the new
> file would start with a massive chunk of binary data at the start.
> Many times on the order of 100-200MB.  This would turn the logs from
> being on the order of 50-100MB to 200-350MB.
>
> My guess was that it had something to do with the byte buffer flushing
> mid-rotate since these chunks always come at the start of the file.
> But I also saw LOG4J2-295 (Fast(Rolling)FileAppender now correctly
> handles messages exceeding the buffer size. ) which was fixed in beta8
> which my discredit that idea.
>
> We were able to fix the issue by using the regular FileAppender like this:
>
>  append="true" bufferedIO="false">
>   
> %m%n
>   
>   
>
> I can't remember for certain, but I am pretty sure that even if we had
> bufferedIO="true" on the FileAppender everything worked okay as well.
>
> We could reproduce it pretty consistently.  I wanted to post to the
> group to see if anyone has seen anything like this before.  Any ideas
> on what the issue could be?
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


Re: Discussion about correct inicialization of log4j2 in OSGi context.

2013-08-15 Thread Remko Popma
Roland,

Sorry, you lost me there...
Are these recommendations to people who want to use Log4j in their OSGi app?
Or changes that need to be made to the Log4j code? (I don't think so, just
wanted to clarify...)
Should this be added to the Log4j manual?

Remko


On Fri, Aug 16, 2013 at 12:33 AM, Roland  wrote:

> Hi all Log4j2 / OSGi experts!
>
> Relates:
>
> https://issues.apache.org/jira/browse/LOG4J2-159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
>
> I recognize that there is a need for discussion how log4j2 can be
> configured
> and started correctly in an OSGi environment.
>
> The standard procedure with configuration files in OSGi is to place them in
> a fragmented bundle, so that the host finds the file in the classpath.
> Obviously, there are still problems in beta9.
>
> Error-msg: StatusLogger Unable to locate a logging implementation, using
> SimpleLogger
>
> Having spent 2 hours figuring out how Log4j2 reads the configurations I've
> capitulated.
>
> So,...I want to tell other readers how I would do it. Maybe I can help...
>
> How I usually load configuration files from fragmented bundles:
> 1. Put the configuration file log4j2.xml to a fragmented bundle.
> (->log4j2-users)
> 2. Implement the "BundleActivator"-interface (OSGi-core) for the
> host-bundle. (->log4j2-devs.)
> 3. Add my.package.MyBundleActivator to
> the maven-bundle-plugin instructions
> (..)
> in the pom.
> 4. Implement the methode "start(BundleContext context)" so that it loads
> the
> log4j2.xml on bundle-startup.
> short expample...
> private void readConfiguration(String directory, String filename)
>   {
> URL url = null;
> Enumeration fileurls = null;
> InputStream is = null;
> //bundlecontext of host
> if(bundlecontext != null) {
>   fileurls = bundlecontext.getBundle().findEntries(directory, filename,
> true);  //get url of configuration
> }
> if((fileurls != null) && (fileurls.hasMoreElements())) {
>   url = fileurls.nextElement();  //take the first
> }
> if(url != null) {
>   is = url.openStream();
> }
> if(is != null) {
> ...
> //read stream
> }
>   }
>
> This is one of among many possibilities how it can be done.
>
> Are there better ideas?
>
> Regards
> Roland
>
>
>
> --
> View this message in context:
> http://apache-logging.6191.n7.nabble.com/Discussion-about-correct-inicialization-of-log4j2-in-OSGi-context-tp39733.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


Re: Log file named ${sys

2013-08-26 Thread Remko Popma
Looks like a string substitution issue in the FastFile appender (renamed to
RandomAccessFile appender in the next release, btw, so you'll need to
change your config when you upgrade).

Can you file a JIRA ticket for this?

Thanks,
Remko

On Tuesday, August 27, 2013, Eric Schwarzenbach wrote:

> I'm using log4j 2.0-beta8 in a webapp, and running it under Tomcat.
>
> I'm setting a system property in my apps ServletContextListener, and using
> that system property in my log4j2.xml file, like so:
>
> 
>
> On my Windows machine, a log file named "${sys." (always 0 bytes) is being
> created instead of a log file with the application-name. The same war
> deployed on one of our linux servers (also tomcat 7, though a slightly
> different version) does not create a ${sys." file and instead creates a log
> file with the intended application-name.
>
> What I think must be happening is that my app's ServletContextListener
> contextInitialized method is getting called before
> Log4jServletContextListener's on the server, but that they are getting
> called in the opposite order on my local machine. The javadoc seems to
> suggest that the intention is for it Log4jServletContextListener's to
> always occur first. This raises several issues:
>
> 1) Is the fact that they get called in different orders on different
> machines a failure of Tomcat to call them in the right order? Or a failure
> of the log4j code to ensure things are set up so as to guarantee this
> order? Or is the order even specified and guarranteeable?
>
> 2) Is Log4jServletContextListener's contextInitialized  being called first
> necessarily desirable? If Log4jServletContextListener always gets called
> before the application's context listener, how is the application to set up
> variables for use in the log4j configuration, particularly, for example
> (which is what I am doing), to get the webapp's name from the servlet
> context path to name the log files? Is there some better way to do this?
> (Ideally without requiring configuration to be loaded twice...which is what
> I ended up happening with logback when I tried to set it up to do this same
> thing.)
>
> According to the servlet spec "The Web container registers the listener
> instances according to the interfaces they implement and the order in which
> they appear in the deployment descriptor. During Web application execution,
> listeners are invoked in the order of their registration." Since
> Log4jServletContextListener doesn't appear in the web.xml, I assume it
> should call them "according to the interfaces they implement". I have no
> idea what that is supposed to mean, though.
>
>
>
>
>
>
>
> --**--**-
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


Re: Error processing element List: CLASS_NOT_FOUND

2013-08-27 Thread Remko Popma
Is this with trunk or beta8?
If trunk, FastFile has been renamed to RandomAccessFile and you'll need to
change your config...

On Tuesday, August 27, 2013, Roland wrote:

> Hello Log4j2 experts,
> I need help with the log4j2-configuration. Thanks in advance!
>
> 2013-08-27 12:55:20,415 ERROR Error processing element List:
> CLASS_NOT_FOUND
> 2013-08-27 12:55:20,415 ERROR Error processing element FastRollingFile:
> CLASS_NOT_FOUND
> 2013-08-27 12:55:20,430 DEBUG Calling createProperty on class
> org.apache.logging.log4j.core.config.Property for element property with
> params(name="filename", value="logfiles/ACOS-RTU-%d{MM-dd-}.log")
> 2013-08-27 12:55:20,430 DEBUG Calling configureSubstitutor on class
> org.apache.logging.log4j.core.config.plugins.PropertiesPlugin for element
> properties with
> params(Properties={filename=logfiles/ACOS-RTU-%d{MM-dd-}.log},
> Configuration(logserviceconfiguration))
> 2013-08-27 12:55:20,430 DEBUG Generated plugins in 0.000137901 seconds
> 2013-08-27 12:55:20,430 DEBUG Calling createLayout on class
> org.apache.logging.log4j.core.layout.PatternLayout for element
> PatternLayout
> with params(pattern="%m%n", Configuration(logserviceconfiguration), null,
> charset="null", alwaysWriteExceptions="null")
> 2013-08-27 12:55:20,430 DEBUG Generated plugins in 0.85547 seconds
> 2013-08-27 12:55:20,430 DEBUG Calling createAppender on class
> org.apache.logging.log4j.core.appender.ConsoleAppender for element Console
> with params(PatternLayout(%m%n), null, target="null", name="STDOUT",
> follow="null", ignoreExceptions="null")
> 2013-08-27 12:55:20,430 DEBUG Jansi is not installed
> 2013-08-27 12:55:20,430 DEBUG Calling createRoute on class
> org.apache.logging.log4j.core.appender.routing.Route for element Route with
> params(ref="null", key="null", Node=Route)
> 2013-08-27 12:55:20,430 ERROR A route must specify an appender reference or
> an appender definition
> 2013-08-27 12:55:20,430 ERROR Route contains an invalid element or
> attribute
> "appender-ref"
> 2013-08-27 12:55:20,430 DEBUG Calling createRoute on class
> org.apache.logging.log4j.core.appender.routing.Route for element Route with
> params(ref="null", key="Audit", Node=Route)
> 2013-08-27 12:55:20,430 ERROR A route must specify an appender reference or
> an appender definition
> 2013-08-27 12:55:20,430 ERROR Null object returned for Route in Routes
> 2013-08-27 12:55:20,430 ERROR Null object returned for Route in Routes
> 2013-08-27 12:55:20,430 DEBUG Calling createRoutes on class
> org.apache.logging.log4j.core.appender.routing.Routes for element Routes
> with params(pattern="${sd:type}", Routes={, })
> 2013-08-27 12:55:20,430 ERROR No routes configured
> 2013-08-27 12:55:20,430 DEBUG Calling createAppender on class
> org.apache.logging.log4j.core.appender.routing.RoutingAppender for element
> Routing with params(name="Routing", ignoreExceptions="null", Routes(null),
> Configuration(logserviceconfiguration), null, null)
> 2013-08-27 12:55:20,430 ERROR No routes defined for RoutingAppender
> 2013-08-27 12:55:20,430 ERROR Null object returned for Routing in appenders
> 2013-08-27 12:55:20,430 DEBUG Calling createAppenders on class
> org.apache.logging.log4j.core.config.plugins.AppendersPlugin for element
> appenders with params(Appenders={STDOUT, })
> 2013-08-27 12:55:20,430 DEBUG Calling createAppenderRef on class
> org.apache.logging.log4j.core.config.AppenderRef for element appender-ref
> with params(ref="Routing", level="null", null)
> 2013-08-27 12:55:20,430 DEBUG Calling createLogger on class
> org.apache.logging.log4j.core.config.LoggerConfig for element logger with
> params(additivity="false", level="info", name="EventLogger",
> includeLocation="null", AppenderRef={Routing}, Properties={},
> Configuration(logserviceconfiguration), null)
> 2013-08-27 12:55:20,430 DEBUG Calling createAppenderRef on class
> org.apache.logging.log4j.core.config.AppenderRef for element appender-ref
> with params(ref="FastRollingFile", level="null", null)
> 2013-08-27 12:55:20,430 DEBUG Calling createLogger on class
> org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element
> root with params(additivity="null", level="debug", includeLocation="null",
> AppenderRef={FastRollingFile}, Properties={},
> Configuration(logserviceconfiguration), null)
> 2013-08-27 12:55:20,430 DEBUG Calling createLoggers on class
> org.apache.logging.log4j.core.config.plugins.LoggersPlugin for element
> loggers with params(Loggers={EventLogger, root})
> 2013-08-27 12:55:20,430 ERROR Unable to locate appender Routing for logger
> EventLogger
> 2013-08-27 12:55:20,430 ERROR Unable to locate appender FastRollingFile for
> logger
> 2013-08-27 12:55:20,446 DEBUG Reconfiguration completed
>
>
> 
>  packages="de.ids.acos.artu">
>   
>  name="filename">logfiles/ACOS-RTU-%d{MM-dd-}.log
>   
>   
> 
> 
> 
> 
>   
> 
> 
>   
> 
>filePattern="logfiles/ACOS-RTU-%d{MM-dd-}.log.gz">
>  

Re: Error processing element List: CLASS_NOT_FOUND

2013-08-27 Thread Remko Popma
Glad I was able to help.

On Tuesday, August 27, 2013, Roland wrote:

> Thanks
>
>
>
> --
> View this message in context:
> http://apache-logging.6191.n7.nabble.com/Error-processing-element-FastRollingFile-CLASS-NOT-FOUND-tp40194p40201.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
>
> -
> To unsubscribe, e-mail: 
> log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: 
> log4j-user-h...@logging.apache.org
>
>


Re: log4j2 + FastFileAppender + Tomcat logrotate problem

2013-08-31 Thread Remko Popma
Kamil,

Did you have a chance to look at the comments on
https://issues.apache.org/jira/browse/LOG4J2-354 ?
Essentially I would recommend you use the log4j built-in mechanism for
rolling over log files instead of an external mechanism. Would that work
for you?

-Remko


On Fri, Aug 16, 2013 at 11:17 AM, Remko Popma  wrote:

> I raised https://issues.apache.org/jira/browse/LOG4J2-354 to track this
> issue.
> I'll add questions in the comments of that JIRA ticket.
>
> Remko
>
>
> On Fri, Aug 16, 2013 at 7:17 AM, Kamil Mroczek wrote:
>
>> Hello,
>>
>> We decided to try out log4j2-beta8 to see if we could improve our
>> logging performance.  We were testing with the disruptor 3.1.1.
>> library to make all our appenders async.
>>
>>
>> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
>>
>> We are running tomcat 7 with Java 1.6.  We use the SLF4J library as well.
>>
>> The appender that we were using in this case was the Fast File
>> Appender with a definition like:
>>
>> > immediateFlush="false" append="true">
>>   
>> %m%n
>>   
>> 
>>
>> And logger was..
>>
>> 
>>   
>> 
>>
>> So the system was designed to allow log4j to do the logging and then
>> have logrotate rotate the log files from the host to an external
>> destination.
>>
>> We rotate the logs every 5 minutes with these params (with LZO
>> compression).
>>
>> compress
>> compresscmd /bin/lzop
>> compressoptions "-U"
>> compressext .lzo
>>
>> What we were seeing was that after a log rotation happened the new
>> file would start with a massive chunk of binary data at the start.
>> Many times on the order of 100-200MB.  This would turn the logs from
>> being on the order of 50-100MB to 200-350MB.
>>
>> My guess was that it had something to do with the byte buffer flushing
>> mid-rotate since these chunks always come at the start of the file.
>> But I also saw LOG4J2-295 (Fast(Rolling)FileAppender now correctly
>> handles messages exceeding the buffer size. ) which was fixed in beta8
>> which my discredit that idea.
>>
>> We were able to fix the issue by using the regular FileAppender like this:
>>
>> > append="true" bufferedIO="false">
>>   
>> %m%n
>>   
>>   
>>
>> I can't remember for certain, but I am pretty sure that even if we had
>> bufferedIO="true" on the FileAppender everything worked okay as well.
>>
>> We could reproduce it pretty consistently.  I wanted to post to the
>> group to see if anyone has seen anything like this before.  Any ideas
>> on what the issue could be?
>>
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>
>>
>


Re: why can log4j2 not print on console in command window

2013-09-08 Thread Remko Popma
If you have  log4j-slf4j-impl-2.0-beta8.jar then I believe you don't
need log4j-over-slf4j-1.7.5.jar
(isn't this jar for log4j-1.2?) Can you remove it and try again?

On Monday, September 9, 2013, 流子℡ <41157...@qq.com> wrote:

> I have use the version beta 8 for log4j2, I have third-party framework
> using in my project ,e.g. spring which using slf4j.
> and i import the jars into my libaray :log4j-over-slf4j-1.7.5.jar
> log4j-api-2.0-beta8.jar log4j-core-2.0-beta8.jar
>  log4j-slf4j-impl-2.0-beta8.jar
>
>
> and my java environment is JDK 7,my configration file named log4j2.xml is
> as following :
>  
>  /log/fish   {LOG_HOME}/backup
> stat   name="SERVER_NAME">global 
>target="SYSTEM_OUT"> pattern="%date{-MM-dd HH:mm:ss.SSS} %level [%thread][%file:%line] -
> %msg%n" /> 
>  
>  filePattern="${LOG_HOME}/${SERVER_NAME}.%d{-MM-dd-HH}.log">
>  
> modulate="true" />  
>   
>   fileName="${LOG_HOME}/${SERVER_NAME}_${STAT_NAME}"
>  filePattern="${LOG_HOME}/${SERVER_NAME}_${STAT_NAME}.%d{-MM-dd-HH}.log">
>  pattern="%date{-MM-dd HH:mm:ss.SSS} %level [%thread][%file:%line] -
> %msg%n" />  
>   modulate="true" />  
>  level="info">   name="org.springframework.beans" level="info">  
> 
>  level="info">name="org.jboss.netty" level="warn">
> 
> name="com.u9.global.service.log" level="info"
> additivity="false"> 
> level="DEBUG">
> 
> 
>
> when I run my project ,it works ok in eclipse,everything print ok in
> console. however,when i compile the project to jar ,and run it by start.bat
> ,log4j2 can.t print output in cmd window,i can't catch the reason,pls help
> me. thank you!


Re: Log level issue with multiple loggers

2013-09-18 Thread Remko Popma
Try setting the log level on the AppenderRef of the root logger:

...

  

  
...

On Wednesday, September 18, 2013, Luigi Alice wrote:

>  Hello,
>
> ** **
>
> I want to log to two different files, each file with different log levels.
> 
>
> Firstly, I defined the root logger with Level ERROR which is writing to
> file number “1”.
>
> Then the second logger with special Logger-Name
> “1292B83C9F81DAB40710C063C441A641.P011Tomcat60001” should log to file
> number “2” with Level ALL.
>
> The problem is:
>
> Log-Level entries in file “2” with the level of WARN and above are also
> logged to file “1”.
>
> But there must only be ERROR-Messages in file “1”.
>
> I don’t want to use additivity=”false” because file 1 is the global logger
> (it logs all activities) and file 2 is only a user-specific logger.
>
> I use Apache Log4j 2 Beta 9
>
> ** **
>
> Here is the configuration:
>
> ** **
>
> 
>
> 
>
> 
>
> 
>
>  
>
>  fileName="${ctx:log.dir}/global.log"
>
>
> filePattern="${ctx:log.dir}/$${date:-MM}/app-%d{MM-dd-}-%i.log">**
> **
>
> 
>
>
> [%d{HH:mm:ss.SSS}|%X{remoteAddr}:%X{session}(%X{page}%X{includeStack}#%X{taskID})|%X{levelNo}]
> %X{location}: %m%n
>
> 
>
> 
>
> 
>
> 
>
> 
>
> 
>
>   
>
> name="1292B83C9F81DAB40710C063C441A641.P011Tomcat60001"
> fileName="${ctx:log.dir}/1292B83C9F81DAB40710C063C441A641.P011Tomcat60001/user.log"
> 
>
>
> filePattern="${ctx:log.dir}/1292B83C9F81DAB40710C063C441A641.P011Tomcat60001/user-%d{-MM-dd}-%i.log">
> 
>
> 
>
>
> [%d{HH:mm:ss.SSS}|%X{remoteAddr}:%X{session}(%X{page}%X{includeStack}#%X{taskID})|%X{levelNo}]
> %X{location}: %m%n
>
> 
>
> 
>
> 
>
> 
>
>   
>
> 
>
>  
>
> 
>
>
>
>   
>
>  level="ALL"> 
>
>  ref="1292B83C9F81DAB40710C063C441A641.P011Tomcat60001"/>   
>
> 
>
> 
>
> 
>
> ** **
>
> ** **
>
> Regards
>
> ** **
>
> Mr.  L. Alice
> Software developer
>
> ** **
>
> __
>
> ** **
>
> 
>
> ** **
>
> Persis GmbH
>
> Erchenstraße 12
>
> 89522 Heidenheim
>
> Tel.: +49 7321 9884-0 ** **
>
> Fax: +49 7321 9884-98
>
> E-Mail: luigi.al...@persis.de  'luigi.al...@persis.de');> 
>
> Web:www.persis.de
>
> __
>
> ** **
>
> Sitz der Gesellschaft: 89522 Heidenheim
> Registergericht: Ulm
> Handelsregister Nr.: HRB 660674
> Geschäftsführer: Rainer Kolb, Michael Barth
>
> ** **
>
> ** **
>
> ** **
>


Re: log4j 2 official release date

2013-09-28 Thread Remko Popma
Michael,

I'd be interested to see your benchmarking code and results. Is it possible for 
you to share them?

Remko

Sent from my iPhone

> On 2013/09/29, at 7:58, Michael Zhou  wrote:
> 
> The micro-benchmark testing I wrote to compare Log4j 1 and 2 shows
> considerable performance gain in favor of Log4j 2.  I have only one request
> for your consideration: simplifying the way to get all loggers in the
> system and set/reset logging levels for certain loggers.  This is very easy
> to do in Log4j 1, but thanks to the rewrite of API and implementation in
> Log4j 2, it becomes complicated.  I did search and read previous
> discussions (in August and May) on this topic, and consider this a much
> needed feature request.  Thanks
> 
> 
> On Sat, Sep 28, 2013 at 2:44 AM, Ralph Goers 
> wrote:
> 
>> I'd prefer to turn this around and ask a couple of questions:
>> 
>> 1. Why do you need to know the "official release" date?  Is something
>> blocking you from using Log4j 2?
>> 2. Are you currently using the beta releases?  Are you satisfied that it
>> is production ready in your environment?
>> 
>> The answers to the questions above are important for us as that is the
>> basis for us labeling the release 2.0 GA vs 2.0 beta10 (or 2.0 RC1).
>> 
>> Ralph
>> 
>>> On Sep 27, 2013, at 8:07 AM, Jingdong Sun wrote:
>>> 
>>> Can anyone tell me when the log4j 2 official release will be available?
>>> 
>>> Thanks.
>>> Jingdong Sun
>>> InfoSphere Streams Development
>>> Phone  507 253-5958  (T/L 553-5958)
>>> jind...@us.ibm.com
>> 
>> 
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> 
> -- 
> Michael

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: log4j 2 official release date

2013-09-30 Thread Remko Popma
Hey, that's my favorite log4j question!
http://logging.apache.org/log4j/2.x/manual/async.html#Performance

Enjoy!
Remko

On Monday, September 30, 2013, Navindian wrote:

> Performance wise, log4j 1.x is better or log4j 2?
>
>
> On Fri, Sep 27, 2013 at 8:37 PM, Jingdong Sun 
> >
> wrote:
>
> > Can anyone tell me when the log4j 2 official release will be available?
> >
> > Thanks.
> > Jingdong Sun
> > InfoSphere Streams Development
> > Phone  507 253-5958  (T/L 553-5958)
> > jind...@us.ibm.com 
>


Re: OutOfMenoryError in log4j-2.0-beta9

2013-09-30 Thread Remko Popma
Thank you for reporting this.
Can I ask you to create a JIRA ticket for this issue? Can you add a few
details: what OS, java version, startup options (especially memory
related), and please attach your log4j2.xml config file.

Ideally also describe how I can reproduce the issue.

What do you mean by "ran a larger file though our system"?

Best regards,
Remko

On Tuesday, October 1, 2013, Yiru Li wrote:

> I have configured to use all loggers asynchronous. When I ran a small file
> over our system, there was no problem.
>
> When  ran a larger file though our system, the problem was raised as
> described below:
>
> Sep 30, 2013 2:56:08 PM com.lmax.disruptor.FatalExceptionHandler
> handleEventExce  ption
> SEVERE: Exception processing: 14451294
> org.apache.logging.log4j.core.async.RingB  ufferLogEvent@226dc6bf
> java.lang.OutOfMemoryError: Java heap space
>
> Exception in thread "AsyncLogger-1" java.lang.RuntimeException:
> java.lang.OutOfM  emoryError: Java heap space
> at
> com.lmax.disruptor.FatalExceptionHandler.handleEventException(FatalEx
>  ceptionHandler.java:45)
> at
> com.lmax.disruptor.BatchEventProcessor.run(BatchEventProcessor.java:1  52)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
>  java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
>  .java:615)
> at java.lang.Thread.run(Thread.java:722)
> Caused by: java.lang.OutOfMemoryError: Java heap space
> Exception in thread "pool-2-thread-3" java.lang.OutOfMemoryError: Java heap
> spac  e
> Exception in thread "Thread-3" java.lang.OutOfMemoryError: Java heap space
> Exception in thread "Thread-2" java.lang.OutOfMemoryError: Java heap space
> Exception in thread "pool-2-thread-1" java.lang.NullPointerException
> at
> org.apache.logging.log4j.core.async.AsyncLogger.log(AsyncLogger.java:  223)
> at
> org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLogger
>  Wrapper.java:55)
> at org.slf4j.impl.SLF4JLogger.warn(SLF4JLogger.java:317)
> at com.envisagesystems.util.logger.LogTag.pattern(LogTag.java:91)
> at
> com.envisagesystems.util.logger.LogTag.getLogMessage(LogTag.java:200)
> at
> com.envisagesystems.cloud.workflow.eventsystem.EventConsumer.logExcep
>  tion(EventConsumer.java:235)
> at
> com.envisagesystems.cloud.workflow.eventsystem.WorkFlowEventHandler.l
>  ogException(WorkFlowEventHandler.java:515)
> at
> com.envisagesystems.cloud.workflow.eventsystemmq.polling.JobQueueRead
>  er.run(JobQueueReader.java:136)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
>  java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
>  .java:615)
> at java.lang.Thread.run(Thread.java:722)
> Exception in thread "pool-2-thread-2" java.lang.NullPointerException
> at
> org.apache.logging.log4j.core.async.AsyncLogger.log(AsyncLogger.java:  223)
> at
> org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLogger
>  Wrapper.java:55)
> at org.slf4j.impl.SLF4JLogger.warn(SLF4JLogger.java:317)
> at com.envisagesystems.util.logger.LogTag.pattern(LogTag.java:91)
> at
> com.envisagesystems.util.logger.LogTag.getLogMessage(LogTag.java:200)
> at
> com.envisagesystems.cloud.workflow.eventsystem.EventConsumer.logExcep
>  tion(EventConsumer.java:235)
> at
> com.envisagesystems.cloud.workflow.eventsystem.WorkFlowEventHandler.l
>  ogException(WorkFlowEventHandler.java:515)
> at
> com.envisagesystems.cloud.workflow.eventsystemmq.polling.JobQueueRead
>  er.run(JobQueueReader.java:136)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
>  java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
>  .java:615)
> at java.lang.Thread.run(Thread.java:722)
> Exception in thread "pool-4-thread-3" java.lang.NullPointerException
> at
> org.apache.logging.log4j.core.async.AsyncLogger.log(AsyncLogger.java:  223)
> at
> org.apache.logging.log4j.spi.AbstractLoggerWrapper.log(AbstractLogger
>  Wrapper.java:55)
> at org.slf4j.impl.SLF4JLogger.debug(SLF4JLogger.java:138)
> at
> com.envisagesystems.cloud.workflow.eventsystemmq.polling.JobQueueRead
>  er$_Runnable.run(JobQueueReader.java:378)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
>  java:1145)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
>  .java:615)
> at java.lang.Thread.run(Thread.java:722)
>


Re: log4j 2 official release date

2013-10-01 Thread Remko Popma
Michael,

I finally got around to looking at the test results you posted on Github (
https://github.com/michaelzhou999/logging-profiling).

Very extensive testing, I can tell you put a lot of work into it!

I was initially a bit surprised by your Log4J2 finding that at ten threads
or more, synchronous logging with RandomAccessFile is even faster than
async logging with RandomAccessFile. But I believe this is because the
performance test logs 500,000 events, and the async logger ring buffer by
default only has 256*1024 slots. When the ring buffer is full the test can
only put new log events into the ring buffer when previous events have been
taken out, so essentially it will be running at the speed of the
RandomAccessFile appender with the additional overhead of going through the
ring buffer.

To be honest I am not sure why this effect does not occur with 1 - 5
threads.

Also interesting to see a similar phenomenon with LogBack:
async appender is faster with 1 - 5 threads, but from 10 threads and up,
synchronous logging is faster than asynchrous logging.

In this case, the LogBack default queue size is only 256, and it is a
fixed-size queue, so it is basically full all the way through the test. So
I think what we're seeing here is the throughput of the underlying appender
plus the contention of the multiple threads trying to add to the queue.
Again unsure about the difference between 10+ threads and 1 - 5 threads...
(I noticed you correctly set the "discardingThreshold" to zero for LogBack
so it won't start dropping trace/debug/info events when the queue is 80%
full.  Well-spotted! Don't allow LogBack to cheat! :-) )

But to make the test fair the LogBack queue size should really be the same
as the Log4J2 async logger queue size (256*1024).

Actually, I would recommend making the queues large enough to contain all
events. If you want to log 500,000 in the test, the queues should be at
least that size. Otherwise the async test will actually be measuring a
partially async and partially synchronous logging.

One final note: are you aware that Log4J2 natively supports SLF4J-style
formatting? e.g. logger.info("hi {}", "world!");

Overall, I was happy to see that your results are similar to the results I
reported in the performance section of the Async Loggers page.

Best regards,
Remko




On Sun, Sep 29, 2013 at 9:59 PM, Michael Zhou wrote:

> Hi Remko,
>
> You can find the micro-benchmarking tool I wrote on Github:
> https://github.com/michaelzhou999/logging-profiling
>
> Drop me a message if you have any questions.  Thanks
>
> Michael
>
>
> On Sat, Sep 28, 2013 at 9:34 PM, Remko Popma 
> wrote:
>
> > Michael,
> >
> > I'd be interested to see your benchmarking code and results. Is it
> > possible for you to share them?
> >
> > Remko
> >
> > Sent from my iPhone
> >
> > > On 2013/09/29, at 7:58, Michael Zhou  wrote:
> > >
> > > The micro-benchmark testing I wrote to compare Log4j 1 and 2 shows
> > > considerable performance gain in favor of Log4j 2.  I have only one
> > request
> > > for your consideration: simplifying the way to get all loggers in the
> > > system and set/reset logging levels for certain loggers.  This is very
> > easy
> > > to do in Log4j 1, but thanks to the rewrite of API and implementation
> in
> > > Log4j 2, it becomes complicated.  I did search and read previous
> > > discussions (in August and May) on this topic, and consider this a much
> > > needed feature request.  Thanks
> > >
> > >
> > > On Sat, Sep 28, 2013 at 2:44 AM, Ralph Goers <
> ralph.go...@dslextreme.com
> > >wrote:
> > >
> > >> I'd prefer to turn this around and ask a couple of questions:
> > >>
> > >> 1. Why do you need to know the "official release" date?  Is something
> > >> blocking you from using Log4j 2?
> > >> 2. Are you currently using the beta releases?  Are you satisfied that
> it
> > >> is production ready in your environment?
> > >>
> > >> The answers to the questions above are important for us as that is the
> > >> basis for us labeling the release 2.0 GA vs 2.0 beta10 (or 2.0 RC1).
> > >>
> > >> Ralph
> > >>
> > >>> On Sep 27, 2013, at 8:07 AM, Jingdong Sun wrote:
> > >>>
> > >>> Can anyone tell me when the log4j 2 official release will be
> available?
> > >>>
> > >>> Thanks.
> > >>> Jingdong Sun
> > >>> InfoSphere Streams Development
> > >>> Phone  507 253-5958  (T/L 553-5958)
> > >>> jind...@us.ibm.com
> > >>
> > >>
> > >> -
> > >> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > >> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> > >
> > >
> > > --
> > > Michael
> >
> > -
> > To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: log4j-user-h...@logging.apache.org
> >
> >
>
>
> --
> Michael
>


Re: Multiple appenders and verbose logging for specific classes for an appender

2013-10-02 Thread Remko Popma
By default, if you set the level of a logger/appender to debug, it will
process debug, info, warn, error and fatal messages.

Is this what you want, or do you want to include only debug-level messages,
and exclude info, warn, error and fatal messages?

On Wednesday, October 2, 2013, fedinho wrote:

> Thanks for your response Jacob.
>
> I've been looking at the additive feature, but I'm not sure it solves my
> requirement.
>
> Given this configuration, I would like to debug class X on appender A, but
> still keep the info level messages from class X on appender B.
>
> I was hoping that this line would make this happen, but doesn't seem to
> work.
> log4j.logger.classX=debug, A
>
> Is there a simple example similar to my requirements somewhere?
>
> Thanks
> Fredrik
>
>
> On Tue, Oct 1, 2013 at 6:50 PM, Jacob Kjome >
> wrote:
>
> > On Tue, 1 Oct 2013 18:17:41 +0200
> >  fedinho > wrote:
> >
> >> Hi.
> >>
> >> A simple question I hope someone can help me with. This is using log4j
> >> 1.2.x
> >>
> >> I would like to log info level to one appender A and warn level to
> another
> >> appenderB.
> >>
> >> However, I would like to log debug messages from class X to appender A,
> >> and
> >> debug messages from class Y to appender B.
> >>
> >> Thanks for any tips for a configuration that will work. Threshold is not
> >> the way to go. Is there a way A and B can have different root loggers or
> >> categories?
> >>
> >>
> > This is usually done by setting the logger additivity to "false" for
> > either the logger in question or one it inherits from, which essentially
> > makes the logger with additivity=false the root logger for all
> inheritors.
> > See...
> >
> >
> http://logging.apache.org/**log4j/1.2/manual.html#**Appenders_and_Layouts<
> http://logging.apache.org/log4j/1.2/manual.html#Appenders_and_Layouts>
> >
> >
> >  Kind regards
> >> Fredrik
> >>
> >
> >
> > --**--**-
> > To unsubscribe, e-mail: log4j-user-unsubscribe@**logging.apache.org<
> log4j-user-unsubscr...@logging.apache.org >
> > For additional commands, e-mail: log4j-user-help@logging.**apache.org<
> log4j-user-h...@logging.apache.org >
> >
> >
>


Re: default value for missing key in mdc

2013-10-09 Thread Remko Popma
Jonathan,
Would you mind raising a JIRA ticket for the issue you're reporting?
That makes it easier for us to track and easier for you to attach config files 
or image files. (The mailing list software may not like image file 
attachments...)

Best regards,
Remko

Sent from my iPhone

> On 2013/10/10, at 6:15, Jonathan Willis  wrote:
> 
> 
> 
> 
> 
>> On Wed, Oct 9, 2013 at 3:05 PM, Ralph Goers  
>> wrote:
>> Can you provide your lookup source?
>> 
>> 
>> On Oct 9, 2013, at 1:22 PM, Jonathan Willis  wrote:
>> 
>> > http://stackoverflow.com/questions/19277445/how-to-use-map-lookups-using-log4j2
>> >
>> >
>> > On Wed, Oct 9, 2013 at 2:18 PM, Ralph Goers 
>> > wrote:
>> >
>> >> Please remember that mine is just one opinion, but I am fine with that.  I
>> >> guess if no default value is provided this way then it can still fall back
>> >> to looking in the properties map.
>> >>
>> >> Ralph
>> >>
>> >>
>> >> On Oct 9, 2013, at 12:53 PM, Woonsan Ko  wrote:
>> >>
>> >>> Hi Ralph,
>> >>>
>> >>>
>> >>> I have something related to this improvement idea.
>> >>> I have thought it might be a bit more useful and flexible to allow
>> >> default value in the variable expression itself.
>> >>> For example, ${var1:-defvalue1}, ${ctx:request_id:-defvalue2}, etc.
>> >>> This generic feature has been included in StrSubstitutor of
>> >> commons-lang3 with the following issue:
>> >>> - https://issues.apache.org/jira/browse/LANG-893
>> >>>
>> >>> I understand Oliver's patch should work more efficiently for map pattern
>> >> converters, but the goodness of the feature with LANG-893 is we can use it
>> >> more widely whenever used in look ups.
>> >>>
>> >>> I know StrSubstitutor in log4j2 added more operations to deal with
>> >> LogEvent argument, so I can create a patch to include the feature of
>> >> LANG-893 if it is useful for others.
>> >>> Also, Oliver's patch won't conflict with this patch.
>> >>>
>> >>> What do you think?
>> >>>
>> >>> Kind regards,
>> >>>
>> >>> Woonsan
>> >>>
>> >>>
>>  On Tuesday, October 1, 2013 9:21 AM, Ralph Goers 
>> >> wrote:
>> > Patches are always welcome!
>> 
>>  Ralph
>> 
>>  On Oct 1, 2013, at 1:13 AM, Oliver Flege  wrote:
>> 
>> >> $${mdc:request_id} in a pattern should cause the request_id to be
>>  evaluated on every event.
>> >
>> > thanks a lot, $${ctx:request_id} seems to do the trick
>> >
>> > however, the computation of the default value is quite complex as it
>> >> always
>>  involves
>> > a variable substitution, and I cannot use conversion specifiers with
>> >> $$ as
>>  I can with %X
>> >
>> > Would you consider accepting a patch that adds support for slf4j-like
>>  default values
>> > in %X{key} and %K{key}, s.th. like %X{key:-defaultValue} ?
>> >
>> > Regards,
>> > Oliver
>> >
>> >
>> >
>> >>
>> >>> On Sep 30, 2013, at 8:04 AM, Oliver Flege 
>>  wrote:
>> >>>
>> >>> ok, this works for ${...} expressions in the configuration,
>>  but I don't see how it would
>> >>> apply to pattern evaluation. To simplify and rephrase my original
>>  question:
>> >>>
>> >>> Given a pattern layout with a pattern like:  %X{REQUEST_ID}
>> >>>
>> >>> is it possible to define a default value that will be printed
>> >>> if the thread never executed
>>  ThreadContext.put("REQUEST_ID", "XYZ")?
>> >>>
>> >>> I tried ${mdc:REQUEST_ID} + a Property REQUEST_ID, but that
>> >>> will only be evaluated when the configuration is parsed.
>> >>>
>> >>> Oliver
>> >>>
>>  Yes, it supports default values. Specify them as properties at
>>  the beginning of your configuration. Then when you specify something
>> >> like
>>  ${sys:foo} if foo is not defined as a system property the default value
>>  will be used,
>> 
>>  Ralph
>> 
>> > On Sep 30, 2013, at 3:30 AM, Oliver Flege
>>   wrote:
>> >
>> > Hi,
>> >
>> > I am considering to switch from slf4j/logback to log4j2;
>> >
>> > in slf4j/logback, I can specify a default value for a
>>  missing mdc entry
>> > like this:
>> >
>> > %d{HH:mm:ss} %X{FOO:--} %c{0}
>>  - %m%n
>> >
>> > which would print "-" if mdc.get("FOO")
>>  is null (the ":-" separates
>> > the key and the default value).
>> >
>> > Having a defined number of tokens/fields at the beginning
>>  of the log message
>> > makes it easier to process it with awk/cut etc.
>> >
>> >
>> > Does log4j support default values? - I could not find any
>>  hint in the documentation
>> >
>> >
>> >
>> > Regards,
>> > Oliver
>> >
>> >
>>  -
>> > To unsubscribe, e-mail:
>>  log4j-user-unsubscr...@lo

Re: default value for missing key in mdc

2013-10-09 Thread Remko Popma
Oh. Sorry. Here you are:
http://logging.apache.org/log4j/2.x/issue-tracking.html

Sent from my iPhone

> On 2013/10/10, at 8:25, Jonathan Willis  wrote:
> 
> How do you create a jira ticket? I looked for where i could but i didnt see
> anywhere that said add issue
>> On Oct 9, 2013 4:47 PM, "Remko Popma"  wrote:
>> 
>> Jonathan,
>> Would you mind raising a JIRA ticket for the issue you're reporting?
>> That makes it easier for us to track and easier for you to attach config
>> files or image files. (The mailing list software may not like image file
>> attachments...)
>> 
>> Best regards,
>> Remko
>> 
>> Sent from my iPhone
>> 
>>>> On 2013/10/10, at 6:15, Jonathan Willis 
>>> wrote:
>>> 
>>> 
>>> 
>>> 
>>> 
>>>> On Wed, Oct 9, 2013 at 3:05 PM, Ralph Goers 
>> wrote:
>>>> Can you provide your lookup source?
>>>> 
>>>> 
>>>> On Oct 9, 2013, at 1:22 PM, Jonathan Willis 
>> wrote:
>>>> 
>> http://stackoverflow.com/questions/19277445/how-to-use-map-lookups-using-log4j2
>>>>> 
>>>>> 
>>>>> On Wed, Oct 9, 2013 at 2:18 PM, Ralph Goers <
>> ralph.go...@dslextreme.com>wrote:
>>>>> 
>>>>>> Please remember that mine is just one opinion, but I am fine with
>> that.  I
>>>>>> guess if no default value is provided this way then it can still
>> fall back
>>>>>> to looking in the properties map.
>>>>>> 
>>>>>> Ralph
>>>>>> 
>>>>>> 
>>>>>>> On Oct 9, 2013, at 12:53 PM, Woonsan Ko  wrote:
>>>>>>> 
>>>>>>> Hi Ralph,
>>>>>>> 
>>>>>>> 
>>>>>>> I have something related to this improvement idea.
>>>>>>> I have thought it might be a bit more useful and flexible to allow
>>>>>> default value in the variable expression itself.
>>>>>>> For example, ${var1:-defvalue1}, ${ctx:request_id:-defvalue2}, etc.
>>>>>>> This generic feature has been included in StrSubstitutor of
>>>>>> commons-lang3 with the following issue:
>>>>>>> - https://issues.apache.org/jira/browse/LANG-893
>>>>>>> 
>>>>>>> I understand Oliver's patch should work more efficiently for map
>> pattern
>>>>>> converters, but the goodness of the feature with LANG-893 is we can
>> use it
>>>>>> more widely whenever used in look ups.
>>>>>>> 
>>>>>>> I know StrSubstitutor in log4j2 added more operations to deal with
>>>>>> LogEvent argument, so I can create a patch to include the feature of
>>>>>> LANG-893 if it is useful for others.
>>>>>>> Also, Oliver's patch won't conflict with this patch.
>>>>>>> 
>>>>>>> What do you think?
>>>>>>> 
>>>>>>> Kind regards,
>>>>>>> 
>>>>>>> Woonsan
>>>>>>> 
>>>>>>> 
>>>>>>>> On Tuesday, October 1, 2013 9:21 AM, Ralph Goers <
>> rgo...@apache.org>
>>>>>> wrote:
>>>>>>>>> Patches are always welcome!
>>>>>>>> 
>>>>>>>> Ralph
>>>>>>>> 
>>>>>>>> On Oct 1, 2013, at 1:13 AM, Oliver Flege  wrote:
>>>>>>>> 
>>>>>>>>>> $${mdc:request_id} in a pattern should cause the request_id to be
>>>>>>>> evaluated on every event.
>>>>>>>>> 
>>>>>>>>> thanks a lot, $${ctx:request_id} seems to do the trick
>>>>>>>>> 
>>>>>>>>> however, the computation of the default value is quite complex as
>> it
>>>>>> always
>>>>>>>> involves
>>>>>>>>> a variable substitution, and I cannot use conversion specifiers
>> with
>>>>>> $$ as
>>>>>>>> I can with %X
>>>>>>>>> 
>>>>>>>>> Would you consider accepting a patch that adds support for
>> slf4j-like
>>>>>>>> default values
>>>>>>>>> in %X{key} and %K{key}, s.th. like 

Re: default value for missing key in mdc

2013-10-09 Thread Remko Popma
Yes. Anyone can read existing issues, but to add or comment you need to
create an account.

Best regards,
Remko

On Thursday, October 10, 2013, Jonathan Willis wrote:

> i am able to view the jira page, and i have been there before, but i don't
> see how to add an issue. Do i need credentials to log in?
>
>
> On Wed, Oct 9, 2013 at 5:43 PM, Remko Popma  wrote:
>
> > Oh. Sorry. Here you are:
> > http://logging.apache.org/log4j/2.x/issue-tracking.html
> >
> > Sent from my iPhone
> >
> > > On 2013/10/10, at 8:25, Jonathan Willis 
> > wrote:
> > >
> > > How do you create a jira ticket? I looked for where i could but i didnt
> > see
> > > anywhere that said add issue
> > >> On Oct 9, 2013 4:47 PM, "Remko Popma"  wrote:
> > >>
> > >> Jonathan,
> > >> Would you mind raising a JIRA ticket for the issue you're reporting?
> > >> That makes it easier for us to track and easier for you to attach
> config
> > >> files or image files. (The mailing list software may not like image
> file
> > >> attachments...)
> > >>
> > >> Best regards,
> > >> Remko
> > >>
> > >> Sent from my iPhone
> > >>
> > >>>> On 2013/10/10, at 6:15, Jonathan Willis 
> > >>> wrote:
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>
> > >>>> On Wed, Oct 9, 2013 at 3:05 PM, Ralph Goers <
> > ralph.go...@dslextreme.com>
> > >> wrote:
> > >>>> Can you provide your lookup source?
> > >>>>
> > >>>>
> > >>>> On Oct 9, 2013, at 1:22 PM, Jonathan Willis <
> quicksilver...@gmail.com
> > >
> > >> wrote:
> > >>>>
> > >>
> >
> http://stackoverflow.com/questions/19277445/how-to-use-map-lookups-using-log4j2
> > >>>>>
> > >>>>>
> > >>>>> On Wed, Oct 9, 2013 at 2:18 PM, Ralph Goers <
> > >> ralph.go...@dslextreme.com>wrote:
> > >>>>>
> > >>>>>> Please remember that mine is just one opinion, but I am fine with
> > >> that.  I
> > >>>>>> guess if no default value is provided this way then it can still
> > >> fall back
> > >>>>>> to looking in the properties map.
> > >>>>>>
> > >>>>>> Ralph
> > >>>>>>
> > >>>>>>
> > >>>>>>> On Oct 9, 2013, at 12:53 PM, Woonsan Ko 
> > wrote:
> > >>>>>>>
> > >>>>>>> Hi Ralph,
> > >>>>>>>
> > >>>>>>>
> > >>>>>>> I have something related to this improvement idea.
> > >>>>>>> I have thought it might be a bit more useful and flexible to
> allow
> > >>>>>> default value in the variable expression itself.
> > >>>>>>> For example, ${var1:-defvalue1}, ${ctx:request_id:-defvalue2},
> etc.
> > >>>>>>> This generic feature has been included in StrSubstitutor of
> > >>>>>> commons-lang3 with the following issue:
> > >>>>>>> - https://issues.apache.org/jira/browse/LANG-893
> > >>>>>>>
> > >>>>>>> I understand Oliver's patch should work more efficiently for map
> > >> pattern
> > >>>>>> converters, but the goodness of the feature with LANG-893 is we
> can
> > >> use it
> > >>>>>> more widely whenever used in look ups.
> > >>>>>>>
> > >>>>>>> I know StrSubstitutor in log4j2 added more operations to deal
> with
>


Re: Log4j2 Appender attributes with strict xml config

2013-10-16 Thread Remko Popma
Perfection may be hard to achieve, but if Alexander's suggestions are an
improvement over the current schema, should we add them to the current code
base?

Remko

On Tuesday, October 15, 2013, Gary Gregory wrote:

> On Mon, Oct 14, 2013 at 11:10 AM, Ralph Goers
> > wrote:
> >
> > On Oct 14, 2013, at 7:31 AM, Gary Gregory 
> > >
> wrote:
> >
> >> The current idea I have is that the XML Schema would reflect exactly
> >> the code that is running. We should start with that. AFAIK, the
> >> current code we have does not allow open-ended XML fragments, but I
> >> could be wrong...
> >>
> >> Gary
> >
> > Of course it allows open-ended XML fragments.  If the user provides
> their own Appender as a plugin they are free to create other plugins that
> the Appender can then reference.  The same is true for Filters, Lookups,
> etc.  XMLConfiguration and JSONConfiguration don't care about specific
> element names - only that they map to a defined plugin.  So any scheme you
> come up with to generate a fully strict schema would have to be able to
> account for user defined plugins.
>
> I should have been more specific, or there is another piece I do not
> understand.
>
> If I or Alexander provide our own Appender, they will be annotated
> with Log4j2 annotations. Today, yes, the XML is open-ended, but not
> per XML Schema. In my imaginary yet-to-be-implemented system, you
> would tell Log4j, at developement or build time of your app, to
> rebuild the metadata such that: (1) the normal config knows about my
> custom appender, and (2) I can generate a new XML Schema.
>
> Gary
>
> >
> > Ralph
> > -
> > To unsubscribe, e-mail: 
> > log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: 
> > log4j-user-h...@logging.apache.org
> >
>
>
>
> --
> E-Mail: garydgreg...@gmail.com  | 
> ggreg...@apache.org
> Java Persistence with Hibernate, Second Edition
> JUnit in Action, Second Edition
> Spring Batch in Action
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>
> -
> To unsubscribe, e-mail: 
> log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: 
> log4j-user-h...@logging.apache.org
>
>


Re: Log4j2 Appender attributes with strict xml config

2013-10-16 Thread Remko Popma
On Wednesday, October 16, 2013, Gary Gregory wrote:

> On Wed, Oct 16, 2013 at 8:48 AM, Remko Popma 
> >
> wrote:
>
> > Perfection may be hard to achieve, but if Alexander's suggestions are an
> > improvement over the current schema, should we add them to the current
> code
> > base?
> >
>
> Probably but where are they? It looks like some text was lost in a reply to
> this thread.
>
> Gary


Hm, it's a bit hard to do this via mail (but perhaps that's just me...)

Alexander,  would you mind raising a JIRA ticket and appending your
modifications to it?
A diff patch file would be ideal.

Best regards,
Remko


>
> > Remko
> >
> > On Tuesday, October 15, 2013, Gary Gregory wrote:
> >
> > > On Mon, Oct 14, 2013 at 11:10 AM, Ralph Goers
> > >  > wrote:
> > > >
> > > > On Oct 14, 2013, at 7:31 AM, Gary Gregory 
> > > > 
> > >
> > > wrote:
> > > >
> > > >> The current idea I have is that the XML Schema would reflect exactly
> > > >> the code that is running. We should start with that. AFAIK, the
> > > >> current code we have does not allow open-ended XML fragments, but I
> > > >> could be wrong...
> > > >>
> > > >> Gary
> > > >
> > > > Of course it allows open-ended XML fragments.  If the user provides
> > > their own Appender as a plugin they are free to create other plugins
> that
> > > the Appender can then reference.  The same is true for Filters,
> Lookups,
> > > etc.  XMLConfiguration and JSONConfiguration don't care about specific
> > > element names - only that they map to a defined plugin.  So any scheme
> > you
> > > come up with to generate a fully strict schema would have to be able to
> > > account for user defined plugins.
> > >
> > > I should have been more specific, or there is another piece I do not
> > > understand.
> > >
> > > If I or Alexander provide our own Appender, they will be annotated
> > > with Log4j2 annotations. Today, yes, the XML is open-ended, but not
> > > per XML Schema. In my imaginary yet-to-be-implemented system, you
> > > would tell Log4j, at developement or build time of your app, to
> > > rebuild the metadata such that: (1) the normal config knows about my
> > > custom appender, and (2) I can generate a new XML Schema.
> > >
> > > Gary
> > >
> > > >
> > > > Ralph
> > > > -
> > > > To unsubscribe, e-mail: 
> > > > log4j-user-unsubscr...@logging.apache.org
> > 
> > > > For additional commands, e-mail: 
> > > > log4j-user-h...@logging.apache.org
> > 
> > > >
> > >
> > >
> > >
> > > --
> > > E-Mail: garydgreg...@gmail.com   |
> ggreg...@apache.org 
> > 
> > > Java Persistence with Hibernate, Second Edition
> > > JUnit in Action, Second Edition
> > > Spring Batch in Action
> > > Blog: http://garygregory.wordpress.com
> > > Home: http://garygregory.com/
> > > Tweet! http://twitter.com/GaryGregory
> > >
> > > -
> > > To unsubscribe, e-mail: 
> > > log4j-user-unsubscr...@logging.apache.org
> > 
> > > For additional commands, e-mail: 
> > > log4j-user-h...@logging.apache.org
> > 
> > >
> > >
> >
>
>
>
> --
> E-Mail: garydgreg...@gmail.com  | 
> ggreg...@apache.org
> Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>


Re: AW: How to get loggers configured in log4j2.xml

2013-10-24 Thread Remko Popma
You can also check with JConsole (see the JMX docs).

Sent from my iPhone

> On 2013/10/24, at 21:06,  wrote:
> 
> Hi,
> 
> Which configuration file are you using?
> If you're using XML try this:
> status="debug"...
> 
> You should then see something along the lines of 
> 
> 2013-10-24 14:03:09,332 DEBUG Calling createLogger on class 
> org.apache.logging.log4j.core.config.LoggerConfig$RootLogger for element Root 
> with params(additivity="null", level="info", includeLocation="null", 
> AppenderRef={STDOUT, FLOW, EXCEPTION}, Properties={}, 
> Configuration(HereWillBeYourConfigurationName), null)
> 
> Does it print the name of the logger you are looking for in your application?
> 
> 
> /Alex
> 
> 
> 
> -Ursprüngliche Nachricht-
> Von: David KOCH [mailto:dk...@ezakus.com] 
> Gesendet: Donnerstag, 24. Oktober 2013 12:04
> An: log4j-user@logging.apache.org
> Betreff: How to get loggers configured in log4j2.xml
> 
> Hello,
> 
> How can I check inside the application if a particular logger has been 
> configured in the log4j configuration file?
> 
> LogManager.getContext(...).hasLogger() always returns "false" even 
> though I know the logger has been configured.
> 
> Thank you,
> 
> /David
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Log4j2 - JConsole JMX appender

2013-10-28 Thread Remko Popma
Hi Mahesh,

Thank you for re-posting your question to the user mailing list.

The Status Logger is a special logger used by log4j internally.
If you set it to "debug" or "trace" (by starting your config xml file
with ...),
it will output things like which appenders and loggers were initialized,
which log4j plugins were found, etc.
Any configuration problems will show up in the status log.
The status log output will appear on the console (System.out).

In JConsole, this internal logging is what you see in the StatusLogger tab.

I'm guessing from your question that you would like to see the log
statements produced by your application in the JConsole viewer.
Unfortunately, JMX currently does not provide a way to show the content of
application log files.

If you are looking for a tool that allows you to view the log file from a
remote machine you may want to take a look at Chainsaw.
http://logging.apache.org/chainsaw/

Scott Deboy has been doing work to make Chainsaw's zeroconf feature work
well with log4j2.
I am not that familiar with Chainsaw, but perhaps this documentation can
get you started:
http://logging.apache.org/log4j/2.x/manual/configuration.html#AdvertisingAppenderConfigurations

Best regards,
Remko



On Tue, Oct 29, 2013 at 9:58 AM, Mahesh Dilhan wrote:

> Hi All,
>
> i'm interested in learning on JMX monitoring in log4j2.
>
> As explained I was able to get the log4j2 'tab' > statusLogger child tab in
> JConsole with the initial logging statements.
>
> Note:version : 2.0.9beta
>
> log4j2.xml
>
> 
>
> 
>
> 
>   
> 
>  fileName="asyncWithLocation.log"
>   immediateFlush="false" append="false">
>   
> %d %p %class{1.} [%t] %location %m %ex%n
>   
> 
>
>   
>   
> 
>  includeLocation="true">
>   
> 
> 
>   
> 
>   
> 
>
> 
> private static Logger logger = LogManager.getLogger("notificationLogger");
>
>
> When web Application(java/servlet/spring) runs I can see the
> file[asyncWithLocation.log] get appended with the logging statements,
> I like to see Jconsole get appended too, But It did not.
>
>
> I wonder, what configuration I should use to enable jmx logging, so that I
> can see them in JConsole?
>
> is there any documentation other than this
> http://logging.apache.org/log4j/2.x/manual/jmx.html,
>
> it would be great if above documentation is updated with a sample of
> log4j2.xml configuration.
>
> Thanks
>
> Mahesh
>


Re: Idea: Is it useful to have an dedicated AWS S3 Appender?

2013-10-30 Thread Remko Popma
Hi Christian,

I'd say go for it! If it's useful to you then it's probably useful for
other people too.

The projects you mention are either for other languages or no longer
actively maintained (afaics), so I don't think you'd be duplicating effort.

Regarding testing, I'm not sure who in the community has access to a ec2
system to test such an appender. So we'd rely on junit tests and community
feedback to fix any issues (but that's not a first).

The way to proceed for this is to supply a patch that one of the committers
can integrate with trunk. You'd need to check out trunk and base your patch
off of that.

To protect the ASF from legal issues, we ask that you submit a CLA (
http://www.apache.org/licenses/#clas) before we can commit your
contribution.

Looking forward to your contribution!

Best regards,
Remko

On Wednesday, October 30, 2013, Christian Schneider wrote:

> Hi,
> for our ec2 instances (with limited diskspace) we like to have a simple
> Appender that ships its logs to s3.
> It seems there is no "standard" way of doing this.
> There are some ideas, but they doesn't seem completed at the first glance
> [0] ... [3]
>
> But before starting a new n-th S3Appender project, I like to ask whether
> you think it would be a great idea?
>
> At the most simplest stage we could think of an extension of the
> RollingFileAppender.
> That Appender is then usable on any machine and in every infrastructure
> that has http access to s3
>
> If this is done, maybe it would be useful to have a more ec2 coupled
> appender.
> That appender could know more about its environment.
> With this, it would be possible to let log4j organize the "upload"-path.
> E.g.: /.
> Or Information about the VPC settings, userscripts, ...
>
> What do you think?
>
> Thanks for you feedback,
> Christian.
>
>
> [0] https://github.com/ryanhosp/mldx-log-appenders
> [1] http://aws.amazon.com/code/Amazon-S3/4032
> [2] http://s3appender.codeplex.com/
> [3] https://github.com/dialt0ne/rotate-to-s3
>


Re: Idea: Is it useful to have an dedicated AWS S3 Appender?

2013-10-30 Thread Remko Popma
You may want to create a Jira ticket that you can attach patch files to
(the mailing list software doesn't like attachments).

Regards,
Remko

On Thursday, October 31, 2013, Remko Popma wrote:

> Hi Christian,
>
> I'd say go for it! If it's useful to you then it's probably useful for
> other people too.
>
> The projects you mention are either for other languages or no longer
> actively maintained (afaics), so I don't think you'd be duplicating effort.
>
> Regarding testing, I'm not sure who in the community has access to a ec2
> system to test such an appender. So we'd rely on junit tests and community
> feedback to fix any issues (but that's not a first).
>
> The way to proceed for this is to supply a patch that one of the
> committers can integrate with trunk. You'd need to check out trunk and base
> your patch off of that.
>
> To protect the ASF from legal issues, we ask that you submit a CLA (
> http://www.apache.org/licenses/#clas) before we can commit your
> contribution.
>
> Looking forward to your contribution!
>
> Best regards,
> Remko
>
> On Wednesday, October 30, 2013, Christian Schneider wrote:
>
>> Hi,
>> for our ec2 instances (with limited diskspace) we like to have a simple
>> Appender that ships its logs to s3.
>> It seems there is no "standard" way of doing this.
>> There are some ideas, but they doesn't seem completed at the first glance
>> [0] ... [3]
>>
>> But before starting a new n-th S3Appender project, I like to ask whether
>> you think it would be a great idea?
>>
>> At the most simplest stage we could think of an extension of the
>> RollingFileAppender.
>> That Appender is then usable on any machine and in every infrastructure
>> that has http access to s3
>>
>> If this is done, maybe it would be useful to have a more ec2 coupled
>> appender.
>> That appender could know more about its environment.
>> With this, it would be possible to let log4j organize the "upload"-path.
>> E.g.: /.
>> Or Information about the VPC settings, userscripts, ...
>>
>> What do you think?
>>
>> Thanks for you feedback,
>> Christian.
>>
>>
>> [0] https://github.com/ryanhosp/mldx-log-appenders
>> [1] http://aws.amazon.com/code/Amazon-S3/4032
>> [2] http://s3appender.codeplex.com/
>> [3] https://github.com/dialt0ne/rotate-to-s3
>>
>


Re: Log4j2 - JConsole JMX appender

2013-10-30 Thread Remko Popma
Async loggers use the LMAX disruptor to remove lock contention when many
threads are logging simultaneously. This is faster than the queue used by
AsyncAppender.
This is all documented I think, but let me know what part of the current
docs should be fixed.

By default the disruptor ringbuffer is configured to be very large & will
consume about 30 MB of memory. This bit can be documented better.

I didn't think it mattered whether the underlying appender does file IO or
network IO. Did I miss something?

Remko

On Thursday, October 31, 2013, Scott Deboy wrote:

> I'm not clear myself on when an async logger is useful - I am more
> familiar with the (previously existing) concept of async appenders.
>
> I think the documentation in this area needs to be enhanced to explain
> why you would use async loggers or async appenders, particularly for
> file IO.
>
> As for generating log files with dates, yes, you can specify your own
> date-related pattern with a RollingFileAppender.  See the
> documentation on RollingFileAppender and examples here:
> http://logging.apache.org/log4j/2.x/manual/appenders.html
>
> Scott
>
> On 10/30/13, Mahesh Dilhan  wrote:
> > Hi Scott
> >
> > I already configured it , yes it works for fileAppeders.
> > I have seen the perftest of async logger. will there be performance hit
> > with fileAppender compared to async logger? I already noticed time taken
> > for initialization process is varying for file and random access file. is
> > it because of "distruptor"?
> >
> > is there a way to output log file name as :
> > "*web-application-context-path*-date.log"
> > ? [configuration of log4j2,xml]
> >
> > Thanks
> >
> >
> >
> >
> > On Thu, Oct 31, 2013 at 3:16 AM, Scott Deboy 
> wrote:
> >
> >> Mi Mahesh,
> >>
> >> If you'd like to use Chainsaw with log4j2, you need to use the latest
> >> Chainsaw developer snapshot, available here:
> >> http://people.apache.org/~sdeboy
> >>
> >> If you use a file appender in your log4j configuration, add the JmDns
> >> jar to your application classpath (http://jmdns.sourceforge.net), and
> >> update your log4j configuration as described in the documentation
> >> (including specifying a URI to your log file), Chainsaw should be able
> >> to parse and tail your log file.
> >>
> >> Feel free to ask additional questions here on the user list.
> >>
> >> Scott
> >>
> >> On 10/28/13, Mahesh Dilhan  wrote:
> >> > Thanks for the clarification Remko
> >> >
> >> >
> >> > On Tue, Oct 29, 2013 at 8:52 AM, Remko Popma 
> >> wrote:
> >> >
> >> >> Hi Mahesh,
> >> >>
> >> >> Thank you for re-posting your question to the user mailing list.
> >> >>
> >> >> The Status Logger is a special logger used by log4j internally.
> >> >> If you set it to "debug" or "trace" (by starting your config xml file
> >> >> with  >> >> status="debug">...),
> >> >> it will output things like which appenders and loggers were
> >> >> initialized,
> >> >> which log4j plugins were found, etc.
> >> >> Any configuration problems will show up in the status log.
> >> >> The status log output will appear on the console (System.out).
> >> >>
> >> >> In JConsole, this internal logging is what you see in the
> StatusLogger
> >> >> tab.
> >> >>
> >> >> I'm guessing from your question that you would like to see the log
> >> >> statements produced by your application in the JConsole viewer.
> >> >> Unfortunately, JMX currently does not provide a way to show the
> >> >> content
> >> >> of
> >> >> application log files.
> >> >>
> >> >> If you are looking for a tool that allows you to view the log file
> >> >> from
> >> a
> >> >> remote machine you may want to take a look at Chainsaw.
> >> >> http://logging.apache.org/chainsaw/
> >> >>
> >> >> Scott Deboy has been doing work to make Chainsaw's zeroconf feature
> >> >> work
> >> >> well with log4j2.
> >> >> I am not that familiar with Chainsaw, but perhaps this documentation
> >> >> can
> >> >> get you started:
> >> >>
> >> >>
> >>
> http://logging.apache.org/log4j/2.x/manual/configuration.html#AdvertisingAppenderConfigurations
> >> >>
> >> >> Best regards,
> >> >> Remko
> >> >>
> >> >>
> >> >>
> >> >> On Tue, Oct 29, 2013 at 9:58 AM, Mahesh Dilhan <
> >>


Re: [LOG4J 2] log4j-1.2-api hardcoded against log4j-core?

2013-11-07 Thread Remko Popma
Hi,

Yes, log4j-1.2-api relies on both api-2.0 and core-2.0.

Best regards,
Remko Popma

On Thursday, November 7, 2013, Andreas Magnusson wrote:

> Hi all, I'm currently prototyping a move from our proprietary logging
> framework to log4j 2.0.
> I've taken the route of creating a bridge from our API to log4j-api
> (inspired by log4j-slf4j-impl) and a "server" bridge in the same way (via
> LoggerContextFactory).
>
> I then created a test application that used log4j-api, log4j-slf4j-impl,
> log4j-jcl , jul (through slf4j), log4j-1.2-api and our own api all at once
> to make sure that everything was translated correctly.
> That's when I got the following exception when getting a logger through
> log4j-1.2-api:
> java.lang.ClassCastException: com.example.InternalContext cannot be cast to
> org.apache.logging.log4j.core.LoggerContext
> at org.apache.log4j.LogManager.getLogger(LogManager.java:77)
> at com.example.loggingTest.Module.log4jLog(Module.java:71)
> at com.example.loggingTest.Module.startModule(Module.java:23)
> at
> com.example.node.application.ModuleLoader$4.run(ModuleLoader.java:735)
>
> Is this by design? The reason I'm asking is that the other bridges (i.e.
> log4j-jcl and log4j-slf4j-impl) are fine with my own defined
> LoggingContext, it's only log4j-1.2-api that has this problem. Of course
> the plan is to use log4j-core as the framework, so it's not that big a deal
> for me personally.
>
> Other than that, great work!
>
> Regards,
> Andreas Magnusson
>


Re: Print logging component name

2013-11-21 Thread Remko Popma
Hi Mayur,

Thanks for checking out log4j!
The web site has many, many example configurations for different use cases. 
Have you had a chance to try all of them? One of them may help you. 

Best regards,
Remko

Sent from my iPhone

> On 2013/11/21, at 20:24, Mayur Patil  wrote:
> 
> Hi,
> 
>   I have just started studying log4j.xml.
> 
>   I have two queries:
> 
>  1. There is not logging values for param in org.apache.log4j as per my
> little
> 
> knowledge. I am able to print name of the host abc.don but I want to
> print
> 
> *abc*
> so I use header; but I want better option?
> 
> 2. I want to print logging component name in the syslog which param should
> I
> 
>use ??
> 
> Seeking for guidance,
> 
> Thanks !!
> 
> 
> -- 
> 
> *Cheers,Mayur*.

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: LogLog equivalent in log4j2?

2013-11-25 Thread Remko Popma
David,

Yes, it's the StatusLogger. 
This class creates the output you see when you configure log4j2 like this:
 On 2013/11/25, at 19:57, David KOCH  wrote:
> 
> Hello,
> 
> In log4j2, is there an equivalent of log4j 1.x'
> LogLogfor
> internal logging purposes?
> 
> Thanks,
> 
> /David

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: log4j2 and log4j1.x conflicts with Kafka

2013-11-25 Thread Remko Popma
David,

Log4j2 comes with an adapter for log4j1.2. (See the FAQ page.)
The adapter will route kafka's calls to the log4j1.x api to the log4j2 
implementation. 

As Gary mentioned, avoid having the old log4j1.x implementation jar in the 
classpath. 

Regards,
Remko

Sent from my iPhone

> On 2013/11/26, at 3:22, David KOCH  wrote:
> 
> Hello,
> 
> I wrote a custom log4j2 appender for Kafka  and
> it seems to be working fine. The only issue I have is that that Kafka
> itself uses log4j 1.x for internal logging so when I use my
> --Dlog4j.configurationFile=my-log4j.xml Kafka generates warnings/errors
> like:
> 
> log4j:WARN No appenders could be found for logger
> (kafka.utils.VerifiableProperties).
> log4j:WARN Please initialize the log4j system properly.
> log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for
> more info.
> SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
> SLF4J: Defaulting to no-operation (NOP) logger implementation
> SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further
> details.
> 
> How can avoid this?
> 
> I guess it's because expects a "log4j 1.x" compatible setup. This is a
> maven project and I include dependencies via the pom.xml. Note that I need
> both log4j1.x (for Kafka) and log4j2.x - for logging to my custom Kafka
> appender and other appenders that I use.
> 
> Thanks,
> 
> /David
> 
> Dependencies in my pom.xml:
> 
> 
> 
> org.apache.logging.log4j
> log4j-api
> 2.0-beta9
> 
> 
> org.apache.logging.log4j
> log4j-core
> 2.0-beta9
> 
> 
> commons-cli
> commons-cli
> 1.2
> 
> 
> org.apache.kafka
> kafka_2.9.2
> 0.8.0-beta1
> 
> 
> com.yammer.metrics
> metrics-core
> 2.2.0
> 
> 
> com.yammer.metrics
> metrics-annotation
> 2.2.0
> 
> 
> log4j
> log4j
> 1.2.17
> 
> 
> org.scala-lang
> scala-library
> 2.9.2
> 
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Any roadmap date for 2.0?

2013-12-03 Thread Remko Popma
I would be okay with releasing what we have now as 2.0-GA.

Based on the JIRAs that have 2.0-rc1 or 2.0 in their target versions, there
is one outstanding bug to do with Log4jServletContextListener
(LOG4J2-359),
and the rest are new feature requests. Personally, I think we can work on
the OSGi stuff and the other feature requests after the 2.0-GA release. I
would be okay with fixing that 359 in a subsequent release.

I think we should either pick a date, or select some _absolutely must have_
JIRAs and release 2.0 when they are done.

Personally I kind of favor the date approach. (Items that are not resolved
before that date go into a subsequent release.)
How about: Jan 31 as our target 2.0 release date?

Thoughts?

PS
The *real* problem is... which logo do we pick?  ;-)
Oh well, maybe we can start worrying about that one when we've fixed a
release date.


On Tue, Dec 3, 2013 at 8:44 PM, Gary Gregory  wrote:

> I would be ok with another release, "rc" or "beta" the name is debatable,
> sooner rather than later. I'm not sure what the other committees are doing
> around the holidays, but it's usually a busy time for folks in the US and
> elsewhere I imagine.
>
> Gary
>
>  Original message 
> From: Francesco Chicchiriccò 
> Date:12/03/2013  05:49  (GMT-05:00)
> To: log4j-user@logging.apache.org
> Subject: Any roadmap date for 2.0?
>
> Hi all,
> is there already any planned release date for 2.0RC1? And what about 2.0?
>
> Thanks.
> Regards.
>
> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
>
> ASF Member, Apache Syncope PMC chair, Apache Cocoon PMC Member
> http://people.apache.org/~ilgrosso/
>
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


Re: Any roadmap date for 2.0?

2013-12-03 Thread Remko Popma
Eric,

Good points, looks like I misfiltered.

Let me rephrase then: what are our release criteria for 2.0-GA?

My personal position is that what we have now is good enough. It may not be
perfect, but I doubt it ever will be (perfect).
So, we should just pick a date, fix what we can before that date and
release.
Bear in mind there will of course be 2.0.1 etc releases.

Remko

On Wednesday, December 4, 2013, Eric Schwarzenbach wrote:

> On 12/3/2013 5:29 PM, Eric Schwarzenbach wrote:
>
>> When I filter in Jira on Open (or Reopened) issues of type Bug, affecting
>> version 2.0-beta9, it lists a couple of dozen issues, not just that one.
>>
>>
> And BTW there are even more if you do not filter on Affects Version,
> which brings in issues such as LOG4J2-441 which do not have an Affects
> Version set (though the description mentions that the issue was found in
> beta9)and those reported as affecting previous betas but never updated.
>
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


Re: log4j2 and ServletContextListeners

2013-12-31 Thread Remko Popma
Giovanni,
If I understand correctly, logging configuration is done partially 
programmatically and partially by config file. These have different target log 
files, and some of the output is showing up in a different target log file than 
expected. 

It's going to be difficult to say anything useful about this without more info. 
The mailing list software doesn't like attachments, so can I ask you to raise a 
ticket in the Jira issue tracker and attach your configuration and the code 
where you programmatically configure logging?

Thanks!
Remko

Sent from my iPhone

> On 2013/12/31, at 1:57, Giovanni Mondo  wrote:
> 
> Hi,
> 
> I’m migrating a web application running on Tomcat from log4j to log4j2.
>  
> The web application has Filters, ServletContextListeners and Servlets .
>  
> Log is expected to be addressed by a Log4jServletContextListener whilst 
> default log is addressed by a log4j2.xml in classpath.
>  
> Filters and Servlets are now logging in the expected log whilst 
> ServletContextListeners are logging in default log.
>  
> Do you think this is the right behaviour or there could be an error in my 
> configuration ?
>  
> Regards,
>  
> Giovanni

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: log4j2 getting started & rolling files

2014-01-05 Thread Remko Popma

> On 2013/12/30, at 5:34, Joe  wrote:
> 
> I found this post while looking for a solution for this problem:
> 
> http://stackoverflow.com/questions/20819376/log4j2-rollingfile-appender-add-custom-info-at-the-start-of-each-logfile
> 
> So, Ralph's statement makes me hope:
>> You can already extend this class and override that method to perform work
>> before or after doing super.rollover(fileManager).
> 
> Ok, extending DefaultRolloverStrategy is looks easy, like this dummy try:
> 
> 
> 
> But I stuck at two things:
> - how to force the RollingFileAppender to use MyRolloverStrategy instead of
> DefaultRolloverStrategy (seems that I have to deal with @Plugin and
> @PluginFactory)?

Yes, that is correct. Your custom strategy needs to have a @Plugin annotation 
and a static factory method annotated with @PluginFactory. 

In the configuration file you'll specify your custom rollover strategy in a 
nested Strategy element of the RolloverAppender configuration. 
(See appender page in manual for example config. )

> - how to write to the logfiles within my rollover method?

Instead of just executing a FileRenameAction like DefaultRolloverStrategy does, 
your action could do the rename, and create a new file with some data already 
saved. 

> 
> Could you help me at this point?
> I would be happy to get some sample source snippets.
> 
> Cheers, Joe
> 
> 
Hope this helps to get you started. 
Best regards,
Remko

> 
> 
> --
> View this message in context: 
> http://apache-logging.6191.n7.nabble.com/log4j2-getting-started-rolling-files-tp8406p42402.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: log4j2 getting started & rolling files

2014-01-05 Thread Remko Popma
Sorry, the mailing list software doesn't like attachments. Maybe it is more 
convenient to open a Jira ticket so you can attach files. 

Regards,
Remko

Sent from my iPhone

> On 2014/01/06, at 7:24, Joe  wrote:
> 
> Ok, I'd already tried to do something with @Plugin and @PluginFactory, but I
> failed
> (that's why I ask for code snippets).
> 
> Here is my not functioning testcode.
> 
> My complete log4j.xml
> 
> 
> And my complete MyRolloverStrategy.java
> 
> 
> It compiles without errors or warnings, but when I start the application, I
> get this error message:
> 
> 
> Any suggestions?
> 
> 
> 
> --
> View this message in context: 
> http://apache-logging.6191.n7.nabble.com/log4j2-getting-started-rolling-files-tp8406p42651.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: log4j2 getting started & rolling files

2014-01-06 Thread Remko Popma
Sorry, I didn't see any source so assumed you had attached files...

Sent from my iPhone

> On 2014/01/06, at 18:29, Joe  wrote:
> 
> Remko Popma-2 wrote
>> Sorry, the mailing list software doesn't like attachments. Maybe it is
>> more convenient to open a Jira ticket so you can attach files.
> 
> Hmm, my post dosn't have attachments, the small source pieces are embedded
> inside the post.
> But if you think, then I'll open a jira issue for this question.
> →  https://issues.apache.org/jira/browse/LOG4J2-486
> <https://issues.apache.org/jira/browse/LOG4J2-486>  
> 
> 
> 
> --
> View this message in context: 
> http://apache-logging.6191.n7.nabble.com/log4j2-getting-started-rolling-files-tp8406p42663.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: Archiving PDF/A

2014-01-07 Thread Remko Popma
When building a new log4j2 release, the manual pages are converted to a PDF
document.
You could take a look at how that is done to see if it is possible to use
this in a custom RolloverStrategy.


On Wed, Jan 8, 2014 at 2:25 AM, Markus Pscheidt
wrote:

> I'm looking for a way to archive log files in PDF/A format. One option
> might be to write a custom rolling file appender that archives in the
> desired PDF format, instead of a standard text format. With the plugin
> structure of Log4j 2 this seems possible.
>
> Has anybody done something similar or any related hints?
>
> Thanks,
> Markus
>


Re: Migrating from log4j 1.2 to log4j 2

2014-01-30 Thread Remko Popma
Hi Abhishek,

These are currently private fields and not easily accessible.
Can you explain your use case? Why do you need this?

Best regards,
Remko


On Thu, Jan 30, 2014 at 2:33 PM, ~Abhi$hek~  wrote:

> Hello Log4j 2 experts,
>
>
>
> I am in the process of migrating my application from log4j 1.2 to log4j 2.0
>
> I have existing code:
>
> Enumeration appenders = logger.getAllAppenders();
>
> .
>
> .
>
> .
>
> fileBackupIndex = rollingFileAppender.getMaxBackupIndex();
>
> maxFileSize = rollingFileAppender.getMaximumFileSize();
>
>
>
> In log4j 2.0 I could not find way to replace above java code. How to get
> list of all appenders and how to get the max value defined for RollingFile
> appender programmatically?
>
> Regards,
> Abhishek
>


Migrating from log4j 1.2 to log4j 2

2014-01-30 Thread Remko Popma
Away from PC now, but if I remember correctly, that method is now commented
as "only used by Junit tests". That may be the most convenient method to
use. We may want to change that comment though...


On Friday, January 31, 2014, Gary Gregory
>
wrote:

> I have finally created a separate sandbox for our app server to test
> porting from log4j1 to 2.
>
> The first thing I run into? Just this issue! ;)
>
> We have code like this:
>
> Logger.getRootLogger().getAllAppenders()
>
> Why? Because the server looks for the log file (if any) so that it can
> return its tail to our client side admin console.
>
> I do not care if the functionality is part of the API, as long as it is in
> the Core. We have custom appenders so we are tied to Log4j (version 1 ATM).
>
> So what's a clean way to get this? I see:
>
> - API: org.apache.logging.log4j.LogManager.getContext() but
> org.apache.logging.log4j.spi.LoggerContext does not surface appenders.
> - Core: org.apache.logging.log4j.core.Logger.getAppenders()
>
> So I think I have a solution:
>
> Map appenders = ((org.apache.logging.log4j.core.Logger)
> LogManager.getRootLogger()).getAppenders();
>
> Where LogManager is in org.apache.logging.log4j.
>
> Gary
>
>
> On Thu, Jan 30, 2014 at 4:23 PM, Remko Popma 
> wrote:
>
> > Hi Abhishek,
> >
> > These are currently private fields and not easily accessible.
> > Can you explain your use case? Why do you need this?
> >
> > Best regards,
> > Remko
> >
> >
> > On Thu, Jan 30, 2014 at 2:33 PM, ~Abhi$hek~  wrote:
> >
> > > Hello Log4j 2 experts,
> > >
> > >
> > >
> > > I am in the process of migrating my application from log4j 1.2 to log4j
> > 2.0
> > >
> > > I have existing code:
> > >
> > > Enumeration appenders = logger.getAllAppenders();
> > >
> > > .
> > >
> > > .
> > >
> > > .
> > >
> > > fileBackupIndex = rollingFileAppender.getMaxBackupIndex();
> > >
> > > maxFileSize = rollingFileAppender.getMaximumFileSize();
> > >
> > >
> > >
> > > In log4j 2.0 I could not find way to replace above java code. How to
> get
> > > list of all appenders and how to get the max value defined for
> > RollingFile
> > > appender programmatically?
> > >
> > > Regards,
> > > Abhishek
> > >
> >
>
>
>
> --
> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>


Re: rolling in log4j2

2014-01-31 Thread Remko Popma
Kireet,

I can reproduce this and I've raised
https://issues.apache.org/jira/browse/LOG4J2-524 to track the issue.
I'll add comments to that Jira ticket as I make progress.

Best regards,
Remko


On Sat, Feb 1, 2014 at 9:28 AM, Kireet  wrote:

> I am trying to use the rolling file appender in log4j2, basically I want
> to roll at midnight daily and keep 3 old log files. New files are created
> properly, but log4j doesn't seem to be cleaning up the old files. Does
> log4j only support cleanup of files within the time period? Here is the
> relevant portion of the config. I tried things with and without the %i
> pattern.
>
>   filePattern="app-%d{-MM-dd}.%i.log">
>   
> %m%n
>   
>   
> 
>   
>   
> 
>
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


Re: rolling in log4j2

2014-01-31 Thread Remko Popma
Kireet, you can find more details on the Jira ticket but to summarize,
you need to configure a SizeBasedTriggeringPolicy for the %i pattern to be
useful.
If you do so, only "max" files are kept _within the same time period_.


On Sat, Feb 1, 2014 at 1:24 PM, Remko Popma  wrote:

> Kireet,
>
> I can reproduce this and I've raised
> https://issues.apache.org/jira/browse/LOG4J2-524 to track the issue.
> I'll add comments to that Jira ticket as I make progress.
>
> Best regards,
> Remko
>
>
> On Sat, Feb 1, 2014 at 9:28 AM, Kireet  wrote:
>
>> I am trying to use the rolling file appender in log4j2, basically I want
>> to roll at midnight daily and keep 3 old log files. New files are created
>> properly, but log4j doesn't seem to be cleaning up the old files. Does
>> log4j only support cleanup of files within the time period? Here is the
>> relevant portion of the config. I tried things with and without the %i
>> pattern.
>>
>> >  filePattern="app-%d{-MM-dd}.%i.log">
>>   
>> %m%n
>>   
>>   
>> 
>>   
>>   
>> 
>>
>>
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>
>>
>


Re: rolling in log4j2

2014-02-01 Thread Remko Popma
Agreed that this seems a common use case. Looking at the
LOG4J2-435<https://issues.apache.org/jira/browse/LOG4J2-435> ticket,
you're now the third person asking for this feature...

Team, what about adding a maxAge attribute to DefaultRolloverStrategy? The
attribute would accept values like "3d" (delete older than 3 days),
similarly "4w" (4 weeks), "5M" (5 months) etc.
The scanned directory would be the parent dir of the rolled over file
specified by the {{filePattern}} attribute, and any file in that directory
would be candidates for deletion.

Thoughts?


On Sunday, February 2, 2014, Arkin Yetis  wrote:

> I had opened the following for this:
> https://issues.apache.org/jira/browse/LOG4J2-435
> Perhaps you can see if this would meet your need and vote for/watch it, if
> it does.
>
>
> On Sat, Feb 1, 2014 at 11:39 AM, Kireet >
> wrote:
>
> > Thanks for the update. So I would need to use an external process to
> clean
> > up older files? This seems like a pretty common use case though right?
> >
> >
> >
> > On 2/1/14 12:19 AM, Remko Popma wrote:
> >
> >> Kireet, you can find more details on the Jira ticket but to summarize,
> >> you need to configure a SizeBasedTriggeringPolicy for the %i pattern to
> be
> >> useful.
> >> If you do so, only "max" files are kept _within the same time period_.
> >>
> >>
> >> On Sat, Feb 1, 2014 at 1:24 PM, Remko Popma 
> >> 
> >
> >> wrote:
> >>
> >>  Kireet,
> >>>
> >>> I can reproduce this and I've raised
> >>> https://issues.apache.org/jira/browse/LOG4J2-524 to track the issue.
> >>> I'll add comments to that Jira ticket as I make progress.
> >>>
> >>> Best regards,
> >>> Remko
> >>>
> >>>
> >>> On Sat, Feb 1, 2014 at 9:28 AM, Kireet >
> wrote:
> >>>
> >>>  I am trying to use the rolling file appender in log4j2, basically I
> want
> >>>> to roll at midnight daily and keep 3 old log files. New files are
> >>>> created
> >>>> properly, but log4j doesn't seem to be cleaning up the old files. Does
> >>>> log4j only support cleanup of files within the time period? Here is
> the
> >>>> relevant portion of the config. I tried things with and without the %i
> >>>> pattern.
> >>>>
> >>>>   >>>>   filePattern="app-%d{-MM-dd}.%i.log">
> >>>>
> >>>>  %m%n
> >>>>
> >>>>
> >>>>  
> >>>>
> >>>>
> >>>>  
> >>>>
> >>>>
> >>>> -
> >>>> To unsubscribe, e-mail: 
> >>>> log4j-user-unsubscr...@logging.apache.org
> >>>> For additional commands, e-mail: 
> >>>> log4j-user-h...@logging.apache.org
> >>>>
> >>>>
> >>>>
> >>>
> >>
> >
> > -
> > To unsubscribe, e-mail: 
> > log4j-user-unsubscr...@logging.apache.org
> > For additional commands, e-mail: 
> > log4j-user-h...@logging.apache.org
> >
> >
>


Re: rolling in log4j2

2014-02-01 Thread Remko Popma
I see. Basically, you are trying to avoid deleting files that were not the
result of a rollover, is that correct?
I don't have a good answer to that yet.

Another use case is patterns like this:
filePattern="logs/%d{-MM}/app-%d{-MM-dd}.%i.log"
where the directory name is or contains a date pattern. So just using the
fixed text prefix part of the filePattern is not sufficient to achieve your
goal...

Alternatively,
filePattern="logs/%d{-MM}/webapp42/app-%d{-MM-dd}.%i.log"
where the directory with the date pattern is not the parent directory of
the rolled over log files.

So I thought we should limit the scan to the directory containing the
rolled over log files...

Obviously, if the parent directory is a pattern that changes every month,
having a "maxAge=2M" (2 months) would never result in a match if we only
scan the directory holding the rolled over log files, so older log files
would never get deleted. That should not be a problem though.

Hm... The only way I can think of to avoid deleting files that were not the
result of rollover is by pattern matching on the name...
I was hoping to avoid that by simply defining the functionality as "any
file in that directory is a candidate for deletion", but I guess this may
be surprising for users...




On Sun, Feb 2, 2014 at 12:13 PM, Kireet  wrote:

> That wouldn't be ideal for me as I have several different log files being
> produced in the same directory, but I do see how it would get pretty
> complicated to pattern match old files to delete selectively. I could
> separate things by folder I guess. What about at least filtering the files
> by everything up until the first pattern? E.g. for the below
> "app-%d{-MM-dd}.%i.log", what about only deleting files that start with
> app- and are older than the maxAge?
>
>
> On 2/1/14 6:59 PM, Remko Popma wrote:
>
>> Agreed that this seems a common use case. Looking at the
>> LOG4J2-435<https://issues.apache.org/jira/browse/LOG4J2-435> ticket,
>>
>> you're now the third person asking for this feature...
>>
>> Team, what about adding a maxAge attribute to DefaultRolloverStrategy? The
>> attribute would accept values like "3d" (delete older than 3 days),
>> similarly "4w" (4 weeks), "5M" (5 months) etc.
>> The scanned directory would be the parent dir of the rolled over file
>> specified by the {{filePattern}} attribute, and any file in that directory
>> would be candidates for deletion.
>>
>> Thoughts?
>>
>>
>> On Sunday, February 2, 2014, Arkin Yetis  wrote:
>>
>>  I had opened the following for this:
>>> https://issues.apache.org/jira/browse/LOG4J2-435
>>> Perhaps you can see if this would meet your need and vote for/watch it,
>>> if
>>> it does.
>>>
>>>
>>> On Sat, Feb 1, 2014 at 11:39 AM, Kireet >
>>>
>>> wrote:
>>>
>>>  Thanks for the update. So I would need to use an external process to
>>>>
>>> clean
>>>
>>>> up older files? This seems like a pretty common use case though right?
>>>>
>>>>
>>>>
>>>> On 2/1/14 12:19 AM, Remko Popma wrote:
>>>>
>>>>  Kireet, you can find more details on the Jira ticket but to summarize,
>>>>> you need to configure a SizeBasedTriggeringPolicy for the %i pattern to
>>>>>
>>>> be
>>>
>>>> useful.
>>>>> If you do so, only "max" files are kept _within the same time period_.
>>>>>
>>>>>
>>>>> On Sat, Feb 1, 2014 at 1:24 PM, Remko Popma >>>> javascript:;>
>>>>>
>>>>
>>>>  wrote:
>>>>>
>>>>>   Kireet,
>>>>>
>>>>>>
>>>>>> I can reproduce this and I've raised
>>>>>> https://issues.apache.org/jira/browse/LOG4J2-524 to track the issue.
>>>>>> I'll add comments to that Jira ticket as I make progress.
>>>>>>
>>>>>> Best regards,
>>>>>> Remko
>>>>>>
>>>>>>
>>>>>> On Sat, Feb 1, 2014 at 9:28 AM, Kireet >>>>> ;>>
>>>>>>
>>>>> wrote:
>>>
>>>>
>>>>>>   I am trying to use the rolling file appender in log4j2, basically I
>>>>>>
>>>>> want
>>>
>>>> to roll at midnight daily and keep 3 old log files. New files are
>>>>>>> created
&g

Re: rolling in log4j2

2014-02-02 Thread Remko Popma
Yes, I was thinking along similar lines.

Something like https://issues.apache.org/jira/browse/LOG4J2-491
but perhaps more general.

I haven't got it all worked out yet but I find the current
DefaultRolloverStrategy difficult to unit-test. E.g., file deletes are not
actions, but renaming and zipping are actions.
It would be nice to separate the logic that generates the "action plan"
from the execution of that action plan. That would facilitate unit testing
and perhaps make it easier to let users insert their own actions in the
chain. Determining deletion candidate files could be part of the logic that
generates the action plan.
Sorry if this all sounds a bit vague atm. Need to think about this some
more...


On Sunday, February 2, 2014, Gary Gregory  wrote:

> Perhaps a different approach would be to have a separate clean up object
> that you give a pattern and an age. This would let you separate the
> rollover concern from the clean up.
>
> Gary
>
>
> On Sat, Feb 1, 2014 at 11:02 PM, Remko Popma 
> wrote:
>
> > I see. Basically, you are trying to avoid deleting files that were not
> the
> > result of a rollover, is that correct?
> > I don't have a good answer to that yet.
> >
> > Another use case is patterns like this:
> > filePattern="logs/%d{-MM}/app-%d{-MM-dd}.%i.log"
> > where the directory name is or contains a date pattern. So just using the
> > fixed text prefix part of the filePattern is not sufficient to achieve
> your
> > goal...
> >
> > Alternatively,
> > filePattern="logs/%d{-MM}/webapp42/app-%d{-MM-dd}.%i.log"
> > where the directory with the date pattern is not the parent directory of
> > the rolled over log files.
> >
> > So I thought we should limit the scan to the directory containing the
> > rolled over log files...
> >
> > Obviously, if the parent directory is a pattern that changes every month,
> > having a "maxAge=2M" (2 months) would never result in a match if we only
> > scan the directory holding the rolled over log files, so older log files
> > would never get deleted. That should not be a problem though.
> >
> > Hm... The only way I can think of to avoid deleting files that were not
> the
> > result of rollover is by pattern matching on the name...
> > I was hoping to avoid that by simply defining the functionality as "any
> > file in that directory is a candidate for deletion", but I guess this may
> > be surprising for users...
> >
> >
> >
> >
> > On Sun, Feb 2, 2014 at 12:13 PM, Kireet  wrote:
> >
> > > That wouldn't be ideal for me as I have several different log files
> being
> > > produced in the same directory, but I do see how it would get pretty
> > > complicated to pattern match old files to delete selectively. I could
> > > separate things by folder I guess. What about at least filtering the
> > files
> > > by everything up until the first pattern? E.g. for the below
> > > "app-%d{-MM-dd}.%i.log", what about only deleting files that start
> > with
> > > app- and are older than the maxAge?
> > >
> > >
> > > On 2/1/14 6:59 PM, Remko Popma wrote:
> > >
> > >> Agreed that this seems a common use case. Looking at the
> > >> LOG4J2-435<https://issues.apache.org/jira/browse/LOG4J2-435> ticket,
> > >>
> > >> you're now the third person asking for this feature...
> > >>
> > >> Team, what about adding a maxAge attribute to DefaultRolloverStrategy?
> > The
> > >> attribute would accept values like "3d" (delete older than 3 days),
> > >> similarly "4w" (4 weeks), "5M" (5 months) etc.
> > >> The scanned directory would be the parent dir of the rolled over file
> > >> specified by the {{filePattern}} attribute, and any file in that
> > directory
> > >> would be candidates for deletion.
> > >>
> > >> Thoughts?
> > >>
> > >>
> > >> On Sunday, February 2, 2014, Arkin Yetis 
> wrote:
> > >>
> > >>  I had opened the following for this:
> > >>> https://issues.apache.org/jira/browse/LOG4J2-435
> > >>> Perhaps you can see if this would meet your need and vote for/watch
> it,
> > >>> if
> > >>> it does.
> > >>>
> > >>>
> > >>> On Sat, Feb 1, 2014 at 11:39 AM, Kireet  > >
> > >>>
> > >>> wrote:
> > >>>
> > >>>  Thanks for the update. So I would need to use an external process to
> > >>>>
> > >>> clean
> > >>>
> > >>>> up older files? This seems like a pretty common use case though
> right?
> > >>>>
> > >>>>
> > >>>>
> > >>>> On 2/1/14 12:19 AM, Remko Popma wrote:
> > >>>>
> --
> E-Mail: garydgreg...@gmail.com  | 
> ggreg...@apache.org
> Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>


Re: rolling in log4j2

2014-02-02 Thread Remko Popma
On Monday, February 3, 2014, Gary Gregory  wrote:

> On Sun, Feb 2, 2014 at 3:11 AM, Remko Popma 
> >
> wrote:
>
> > Yes, I was thinking along similar lines.
> >
> > Something like https://issues.apache.org/jira/browse/LOG4J2-491
> > but perhaps more general.
> >
> > I haven't got it all worked out yet but I find the current
> > DefaultRolloverStrategy difficult to unit-test. E.g., file deletes are
> not
> > actions, but renaming and zipping are actions.
> > It would be nice to separate the logic that generates the "action plan"
> > from the execution of that action plan. That would facilitate unit
> testing
> > and perhaps make it easier to let users insert their own actions in the
> > chain. Determining deletion candidate files could be part of the logic
> that
> > generates the action plan.
> > Sorry if this all sounds a bit vague atm. Need to think about this some
> > more...
> >
>
> In this area, I'd like to rename
>
> org.apache.logging.log4j.core.appender.rolling.helper
>
> to
>
> org.apache.logging.log4j.core.appender.rolling.action
>
> Thoughts?


I see what you mean: it currently only contains action classes. However, I
may need to create other support classes for what I have in mind, and that
may be a good place to put them.
Also the current name is consistent with the core.helpers package.
Would you mind if we leave it as it is for now?
-Remko


>
> Gary
>
>
> >
> > On Sunday, February 2, 2014, Gary Gregory 
> wrote:
> >
> > > Perhaps a different approach would be to have a separate clean up
> object
> > > that you give a pattern and an age. This would let you separate the
> > > rollover concern from the clean up.
> > >
> > > Gary
> > >
> > >
> > > On Sat, Feb 1, 2014 at 11:02 PM, Remko Popma 
> > > wrote:
> > >
> > > > I see. Basically, you are trying to avoid deleting files that were
> not
> > > the
> > > > result of a rollover, is that correct?
> > > > I don't have a good answer to that yet.
> > > >
> > > > Another use case is patterns like this:
> > > > filePattern="logs/%d{-MM}/app-%d{-MM-dd}.%i.log"
> > > > where the directory name is or contains a date pattern. So just using
> > the
> > > > fixed text prefix part of the filePattern is not sufficient to
> achieve
> > > your
> > > > goal...
> > > >
> > > > Alternatively,
> > > > filePattern="logs/%d{-MM}/webapp42/app-%d{-MM-dd}.%i.log"
> > > > where the directory with the date pattern is not the parent directory
> > of
> > > > the rolled over log files.
> > > >
> > > > So I thought we should limit the scan to the directory containing the
> > > > rolled over log files...
> > > >
> > > > Obviously, if the parent directory is a pattern that changes every
> > month,
> > > > having a "maxAge=2M" (2 months) would never result in a match if we
> > only
> > > > scan the directory holding the rolled over log files, so older log
> > files
> > > > would never get deleted. That should not be a problem though.
> > > >
> > > > Hm... The only way I can think of to avoid deleting files that were
> not
> > > the
> > > > result of rollover is by pattern matching on the name...
> > > > I was hoping to avoid that by simply defining the functionality as
> "any
> > > > file in that directory is a candidate for deletion", but I guess this
> > may
> > > > be surprising for users...
> > > >
> > > >
> > > >
> > > >
> > > > On Sun, Feb 2, 2014 at 12:13 PM, Kireet  wrote:
> > > >
> > > > > That wouldn't be ideal for me as I have several different log files
> > > being
> > > > > produced in the same directory, but I do see how it would get
> pretty
> > > > > complicated to pattern match old files to delete selectively. I
> could
> > > > > separate things by folder I guess. What about at least filtering
> the
> > > > files
> > > > > by everything up until the first pattern? E.g. for the below
> > > > > "app-%d{-MM-dd}.%i.log", what about only deleting files that
> > start
> > > > with
> > > > > app- and are older than the maxAge?
> > > > >
> > >

Re: Async Loggers and Appenders

2014-02-06 Thread Remko Popma
On Thursday, February 6, 2014, McCarthy, Peter (Peter) 
wrote:

> Folks,
> In documentation for Async appenders you state the following :
>
> "Asynchronous Appenders already existed in Log4j 1.x, but have been
> enhanced to flush to disk at the end of a batch (when the queue is empty).
> This produces the same result as configuring "immediateFlush=true", that
> is, all received log events are always available on disk, but is more
> efficient because it does not need to touch the disk on each and every log
> event. (Async Appenders use ArrayBlockingQueue internally and do not need
> the disruptor jar on the classpath.)"
>
> In the case of an abnormal termination of the jvm (e.g. a native thread
> references an invalid memory location causing a segmentation fault), the
> above statement would not hold true as the contents of the buffer would be
> lost depending on whether the shutdown hooks were called or not. Is this a
> reasonable assumption?


Yes, more or less: if you get a segfault it is safe to assume that all data
that was only in memory and not on disk is now lost. But bear in mind that
shutdown hooks are only called when the JVM _shuts down_. They won't be
called when you get a segfault.


> Also for Asynchronous Appenders, ensuring that their buffers are flushed
> relies on the fact that shutdown hooks are invoked, is this also correct?


No, shutdown hooks are not necessary. Async Appenders (and Async Loggers)
will simply signal to the underlying appender for each log event whether
this event is the "end of a batch of events". (False if there are still
other events remaining in the queue, true if the current event is the last
one in the queue.)
This allows the underlying appender to avoid unnecessary calls to flush()
the buffer. However, the buffer _will_ be flushed at the end of a batch.
This does not rely on shutdown hooks. If your application somehow puts log
events in the queue at a rate that the queue is never empty, the
underlying appender
will still flush every time the buffer is full. Either way, shutdown hooks
don't come into play.

Regards, -Remko

Thanks for your opinion on these matters
>
> Regards
> Peter McCarthy
>


Re: Loading multiple different xml configuration files from different components within process

2014-02-07 Thread Remko Popma
Peter,

I did not fully understand what you are trying to achieve, so I may be
completely off the mark, but are you aware that Log4J supports XInclude for
XML configurations? See also:
https://issues.apache.org/jira/browse/LOG4J2-341

This may be much, much easier than trying to approach this programmatically.

Hope this helps,
-Remko




On Wed, Feb 5, 2014 at 7:24 PM, McCarthy, Peter (Peter)
wrote:

> Sorry folks,
>
> The commented out bit of code in first post may be misleading. I have
> corrected it below. When I use the command line -Dlog4j.configurationFile,
> I leave the static block out of the program.
>
> Again all help appreciated...
>
> Regards
> Peter
>
> -Original Message-
> From: McCarthy, Peter (Peter)
> Sent: 05 February 2014 09:34
> To: Log4J Users List
> Subject: Loading multiple different xml configuration files from different
> components within process
>
> Folks,
>
> I am trying to programmatically configure multiple xml files as I want
> each sub system using log4j2 to "own" its own configuration (As opposed to
> having them all in one monolithic block).
>
> I have tried the code below with an xml that reconfigures the root logger
> to a separate file. When I load the config file from the command line
> (-Dlog4j.configuration) everything works fine. However when loaded using
> the code below, the output goes to the default root logger. When I look at
> the log4j logs themselves it states that is has set up the root logger
> using my appender, however the log statements do NOT go to my appender.
>
> The relevant config is also included. Any help is greatly appreciated !!
>
> Regards
> Peter McCarthy
>
> public class MyLogger {
>
> private static Logger logger;
>
> static {
> File logConfigFile = new File( "log4j2_SGM.xml" );
> try {
> FileInputStream fis = new FileInputStream( logConfigFile );
> XMLConfigurationFactory fc = new XMLConfigurationFactory( );
> fc.getConfiguration(  new
> ConfigurationFactory.ConfigurationSource( fis ) );
>
> URI configuration = logConfigFile.toURI();
> Configurator.initialize("config", null, configuration);
>
> org.apache.logging.log4j.core.LoggerContext ctx =
> (org.apache.logging.log4j.core.LoggerContext)
> LogManager.getContext( true );
> ctx.reconfigure();
> } catch (FileNotFoundException e) {
> e.printStackTrace();
> }
>
> logger = LogManager.getLogger(MyLogger.class);
> }
>
> /**
>  * @param args
>  */
> public static void main(String[] args) {
> int myNum = 0;
>
> while (true) {
> logger.error("Hello, World! ", myNum++);
> if ( myNum == 10 ) {
> break;
> }
> }
> }
>
> }
>
> 
> 
>   
> DEBUG
> DEBUG
> DEBUG
> DEBUG
> 50 KB
> 5
>   
>   
> 
>   
> 
>
>  fileName="C:\\Avaya\\Logs\\CCMS\\CCMS_SGM_SipSp.log"
> filePattern="C:\\Avaya\\Logs\\CCMS\\CCMS_SGM_SipSp%i.log" append="true"
> immediateFlush="false">
>   
> %d{dd/MM HH:mm:ss.SSS} [%-16.16t] %-5p %-30.30c -
> %m%n
>   
>   
> 
>   
>   
> 
>
>   
>
>   
> 
> 
> 
>
>  
>  
> 
>   
> 
> -Original Message-
> From: Gary Gregory [mailto:garydgreg...@gmail.com]
> Sent: 04 February 2014 05:23
> To: Log4J Users List
> Subject: Re: rolling in log4j2
>
> On Sun, Feb 2, 2014 at 7:49 PM, Ralph Goers  wrote:
>
> > The actions originated with the Log4j1 extended design and code. I
> > started from that and then tried to merge the rollover strategies into
> > something that made sense to me. That doesn't mean it can't be changed.
> >
>
> It feels like a neat focused package. I would not like a generic 'helper'
> package to become a dumping ground or kitchen sink for other stuff.
>
> I think I'll change in the AM.
>
> Gary
>
>
> > Sent from my iPad
> >
> > > On Feb 2, 2014, at 12:11 AM, Remko Popma 
> wrote:
> > >
> > > Yes, I was thinking along similar lines.
> > >
> > > Something like https://issues.apache.org/jira/browse/LOG4J2-491
> > > but perhaps more general.
> > >
> > > I haven't got it all worked out yet but I find the current
> > > Defa

Re: Overlapping Classes

2014-02-08 Thread Remko Popma
Hi Chris,

Log4j-1.2 is not actively maintained anymore. On the other hand, log4j-2.0
is under active development/maintenance and IMHO stable enough for
production use.
We are in the middle of rolling out a 2.0-RC1 release, which should be
available for download in a couple of days.
Would it be an option for you to use log4j-2.0 instead of log4j-1.2 +
extras? If there is some feature in extras that is not in 2.0, please let
us know!

-Remko

On Sunday, February 9, 2014, Chris Veal  wrote:

> I'm using apache-log4j-extras-1.2.17 and log4j-1.2.17.
>
> The maven shade plugin provides the ability to relocate these jars into
> separate packages so that they wouldn't overlap. I could assign each jar
> its own package name. Would that be recommended? Or, does the extras code
> purposefully overlap the log4j code in an attempt to override that code?
>
> Thanks,
>
> Chris
>
>
>
>
> On Sat, Feb 8, 2014 at 3:18 PM, Matt Sicker >
> wrote:
>
> > Actually, let me follow that up with a further question: is this in a
> log4j
> > 1.2.17 environment only, or is this when paired with log4j 2.0?
> >
> >
> > On 7 February 2014 20:25, Matt Sicker >
> wrote:
> >
> > > Using an OSGi framework would help. It has separate class loaders for
> > each
> > > bundle you install. Check out Apache Felix or Eclipse Equinox or some
> > other
> > > implementation.
> > >
> > > Matt Sicker
> > >
> > > > On Feb 7, 2014, at 16:35, Chris Veal >
> wrote:
> > > >
> > > > I'm using the maven shade plugin with apache-log4j-extras-1.2.17
> > > > and log4j-1.2.17. That plugin takes the project artifacts and all its
> > > > dependencies and puts them in a single jar. During compilation, the
> > > plugin
> > > > states:
> > > >
> > > > [WARNING] apache-log4j-extras-1.2.17.jar, log4j-1.2.17.jar define 126
> > > > overlappping classes:
> > > > [WARNING]   - org.apache.log4j.xml.DOMConfigurator$2
> > > > [WARNING]   - org.apache.log4j.xml.DOMConfigurator$5
> > > > [WARNING]   - org.apache.log4j.NDC$DiagnosticContext
> > > > [WARNING]   - org.apache.log4j.spi.AppenderAttachable
> > > > [WARNING]   - org.apache.log4j.spi.ErrorHandler
> > > > [WARNING]   - org.apache.log4j.spi.RootCategory
> > > > [WARNING]   - org.apache.log4j.pattern.PatternConverter
> > > > [WARNING]   - org.apache.log4j.TTCCLayout
> > > > [WARNING]   - org.apache.log4j.RollingCalendar
> > > > [WARNING]   - org.apache.log4j.spi.Configurator
> > > > [WARNING]   - 116 more...
> > > > [WARNING] maven-shade-plugin has detected that some .class files
> > > > [WARNING] are present in two or more JARs. When this happens, only
> > > > [WARNING] one single version of the class is copied in the uberjar.
> > > > [WARNING] Usually this is not harmful and you can skeep these
> > > > [WARNING] warnings, otherwise try to manually exclude artifacts
> > > > [WARNING] based on mvn dependency:tree -Ddetail=true and the above
> > > > [WARNING] output
> > > > [WARNING] See
> http://docs.codehaus.org/display/MAVENUSER/Shade+Plugin
> > > >
> > > > If I exclude apache-log4j-extras-1.2.17, then my code complains about
> > not
> > > > having the updated RollingAppender.
> > > >
> > > > If I exclude log4j-1.2.17, then my code complains that it can't find
> > > > RendererMap.
> > > >
> > > > Any ideas on how to get this code to work properly with the
> overlapping
> > > > classes?
> > > >
> > > > Thanks,
> > > >
> > > > Chris
> > >
> >
> >
> >
> > --
> > Matt Sicker >
> >
>


Re: Loading multiple different xml configuration files from different components within process

2014-02-10 Thread Remko Popma
Great! Glad to be of help.
Remko

On Monday, February 10, 2014, McCarthy, Peter (Peter) 
wrote:

> Hi Remko,
>
> Yes this is exactly what I was looking for, and it does save me a large
> amount of effort. thanks you very much for the very useful feedback.
>
> Regards
> Peter
>
> ________
> From: Remko Popma [remko.po...@gmail.com ]
> Sent: 07 February 2014 18:15
> To: Log4J Users List
> Subject: Re: Loading multiple different xml configuration files from
> different components within process
>
> Peter,
>
> I did not fully understand what you are trying to achieve, so I may be
> completely off the mark, but are you aware that Log4J supports XInclude for
> XML configurations? See also:
> https://issues.apache.org/jira/browse/LOG4J2-341
>
> This may be much, much easier than trying to approach this
> programmatically.
>
> Hope this helps,
> -Remko
>
>
>
>
> On Wed, Feb 5, 2014 at 7:24 PM, McCarthy, Peter (Peter)
> wrote:
>
> > Sorry folks,
> >
> > The commented out bit of code in first post may be misleading. I have
> > corrected it below. When I use the command line
> -Dlog4j.configurationFile,
> > I leave the static block out of the program.
> >
> > Again all help appreciated...
> >
> > Regards
> > Peter
> >
> > -Original Message-
> > From: McCarthy, Peter (Peter)
> > Sent: 05 February 2014 09:34
> > To: Log4J Users List
> > Subject: Loading multiple different xml configuration files from
> different
> > components within process
> >
> > Folks,
> >
> > I am trying to programmatically configure multiple xml files as I want
> > each sub system using log4j2 to "own" its own configuration (As opposed
> to
> > having them all in one monolithic block).
> >
> > I have tried the code below with an xml that reconfigures the root logger
> > to a separate file. When I load the config file from the command line
> > (-Dlog4j.configuration) everything works fine. However when loaded using
> > the code below, the output goes to the default root logger. When I look
> at
> > the log4j logs themselves it states that is has set up the root logger
> > using my appender, however the log statements do NOT go to my appender.
> >
> > The relevant config is also included. Any help is greatly appreciated !!
> >
> > Regards
> > Peter McCarthy
> >
> > public class MyLogger {
> >
> > private static Logger logger;
> >
> > static {
> > File logConfigFile = new File( "log4j2_SGM.xml" );
> > try {
> > FileInputStream fis = new FileInputStream( logConfigFile );
> > XMLConfigurationFactory fc = new XMLConfigurationFactory( );
> > fc.getConfiguration(  new
> > ConfigurationFactory.ConfigurationSource( fis ) );
> >
> > URI configuration = logConfigFile.toURI();
> > Configurator.initialize("config", null, configuration);
> >
> > org.apache.logging.log4j.core.LoggerContext ctx =
> > (org.apache.logging.log4j.core.LoggerContext)
> > LogManager.getContext( true );
> > ctx.reconfigure();
> > } catch (FileNotFoundException e) {
> > e.printStackTrace();
> > }
> >
> > logger = LogManager.getLogger(MyLogger.class);
> > }
> >
> > /**
> >  * @param args
> >  */
> > public static void main(String[] args) {
> > int myNum = 0;
> >
> > while (true) {
> > logger.error("Hello, World! ", myNum++);
> > if ( myNum == 10 ) {
> > break;
> > }
> > }
> > }
> >
> > }
> >
> > 
> > 
> >   
> > DEBUG
> > DEBUG
> >


Re: Logo contest: nominate your favorite logo

2014-02-16 Thread Remko Popma
On Monday, February 17, 2014, Gary Gregory  wrote:

> On Sun, Feb 16, 2014 at 8:18 PM, Ralph Goers 
> 
> >wrote:
>
> > Because I would like to participate and am still in the hospital. Not
> easy
> > to do stuff only from my phone or iPad
> >
>
> Ralph,
>
> I am sorry to hear you are still ill. Please do get well soon.
> All the best,
> Gary

+1
Get well soon!
Remko

>
>
> > Sent from my iPhone
> >
> > > On Feb 16, 2014, at 4:28 PM, Gary Gregory 
> > wrote:
> > >
> > > Also, why not let people vote on all the logos, on the ML? The wiki
> step
> > seems to be like an exercise... the original plan called for a two rounds
> > for votes, presumably on the ML. Why wait until Thursday? Why not start
> > Monday?
> > >
> > > Gary
> > >
> > >
> > >> On Sun, Feb 16, 2014 at 1:59 PM, Christian Grobmeier <
> > grobme...@gmail.com> wrote:
> > >> I think it was me who was thinking wrong, sorry.
> > >>
> > >> Then let's start the round-1-vote coming thursday.
> > >>
> > >> Cheers
> > >> Christian
> > >>
> > >> On 16 Feb 2014, at 15:53, Gary Gregory wrote:
> > >>
> > >> > The wiki lists more than 10. What am I missing?
> > >> >
> > >> > G
> > >> >
> > >> >  Original message 
> > >> > From: Christian Grobmeier 
> > >> > Date:02/15/2014  14:38  (GMT-05:00)
> > >> > To: Log4J Developers List 
> > >> > Cc: Log4J Users List 
> > >> > Subject: Re: Logo contest: nominate your favorite logo
> > >> >
> > >> > Uh? What did I change?
> > >> >
> > >> > I mentioned we should vote on the 10 logos with most votes if we
> have
> > >> > enough logos.
> > >> > At the moment we have to less expressed support for any logos to
> chose
> > >> > the ten.
> > >> >
> > >> > Or which one would you let fall of the table?
> > >> >
> > >> >
> > >> > On 15 Feb 2014, at 20:14, Gary Gregory wrote:
> > >> >
> > >> >> Let's not change the rules in the middle of the game here...
> > >> >>
> > >> >>  Original message 
> > >> >> From: Christian Grobmeier 
> > >> >> Date:02/15/2014  13:21  (GMT-05:00)
> > >> >> To: Log4J Developers List ,Log4J
> Users
> > >> >> List 
> > >> >> Subject: Re: Logo contest: nominate your favorite logo
> > >> >>
> > >> >> I would like to encourage everybody who didn't voice his opinion on
> > >> >> the
> > >> >> logos to do it now. If somebody prefers to respond to the mailing
> > list
> > >> >> with
> > >> >> his/her thoughts I am happy to fill the wiki with.
> > >> >>
> > >> >> My suggestion is to start a final vote on coming thursday.
> > >> >> Also I think we should only on the logos which are currently
> > >> >> supported by minimum 2 persons.
> > >> >>
> > >> >>
> > >> >>
> > >> >> On 2 Feb 2014, at 11:21, Christian Grobmeier wrote:
> > >> >>
> > >> >>> Hi all,
> > >> >>>
> > >> >>> please show your support for your favorite logo on this wiki page:
> > >> >>> http://wiki.apache.org/logging/Log4jLogoNominations
> > >> >>>
> > >> >>> I added a few nominations already, just stick with the format.
> > >> >>>
> > >> >>> Everybody reading this message is invited to nominate their
> favorite
> > >> >>> logo.
> > >> >>>
> > >> >>> Cheers,
> > >> >>> Christian
> > >> >>
> > Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition 
> Spring Batch in Action 
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory
>


Re: commons logging

2014-02-20 Thread Remko Popma
Leos,

It looks correct to me...

Question: are the jar files all located in WEB-INF/lib (of the same war file 
that contains WEB-INF/classes/log4j2.xml)?

Remko

Sent from my iPhone

> On 2014/02/21, at 7:10, Leos Literak  wrote:
> 
>  
> Hi,
>  
> I have servlet with apache commons logging, and following jars:
>  
> commons-logging-1.1.3.jar json-smart-1.1.1.jar log4j-api-2.0-rc1.jar 
> log4j-core-2.0-rc1.jar log4j-jcl-2.0-rc1.jar
> 
> 
> 
> I have no LOG4J configuration in web.xml, but it prints during deployment in 
> WildFly:
> 
> 
> 
> 22:48:01,336 INFO [io.undertow.servlet] (MSC service thread 1-11) 
> Log4jServletContainerInitializer starting up Log4j in Servlet 3.0+ 
> environment.
> 
> 22:48:01,688 INFO [io.undertow.servlet] (MSC service thread 1-11) No Log4j 
> context configuration provided. This is very unusual.
> 
> 22:48:01,702 INFO [io.undertow.servlet] (MSC service thread 1-11) 
> Log4jServletContextListener ensuring that Log4j starts up properly.
> 
> 
> 
> The log4j2.xml is located in classes under WEB-INF:
> 
> 
> 
> 
> 
>  
> 
>  
> 
>  c:/dev/oauth2.log
> 
>  
> 
>  
> 
>   immediateFlush="true">
> 
>  
> 
>  %d %p %C{1.} [%t] %m%n
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
>  
> 
> 
> 
> 
> 
> The file is created but it is empty. When I explicitelly created LOG4J 
> Logger, then it logs the statement to this file. But logging's Log does not 
> work.
> 
> What is wrong?
> 
> 
> 
> Thanks
> 
> 
> 
> Leos
> 
> 
> 
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org


Re: commons logging

2014-02-20 Thread Remko Popma
Leos,

Thanks! Can I ask you to create a Jira ticket to track this issue?

Best regards,
Remko

Sent from my iPhone

> On 2014/02/21, at 15:50, Leos Literak  wrote:
> 
> Reproduced with minimal war, see literak.cz/zaloha/CommonsLog.war
> You will need to update log location.
>  
> Wildfly 80RC1
>  
> Leos
>  
> ______
>> Od: Remko Popma 
>> Komu: Log4J Users List 
>> Datum: 21.02.2014 00:37
>> Předmět: Re: commons logging
> Leos,
> 
> It looks correct to me...
> 
> Question: are the jar files all located in WEB-INF/lib (of the same war file 
> that contains WEB-INF/classes/log4j2.xml)?
> 
> Remko
> 
> Sent from my iPhone
> 
>> On 2014/02/21, at 7:10, Leos Literak  wrote:
>> 
>>  
>> Hi,
>>  
>> I have servlet with apache commons logging, and following jars:
>>  
>> commons-logging-1.1.3.jar json-smart-1.1.1.jar log4j-api-2.0-rc1.jar 
>> log4j-core-2.0-rc1.jar log4j-jcl-2.0-rc1.jar
>> 
>> 
>> 
>> I have no LOG4J configuration in web.xml, but it prints during deployment in 
>> WildFly:
>> 
>> 
>> 
>> 22:48:01,336 INFO [io.undertow.servlet] (MSC service thread 1-11) 
>> Log4jServletContainerInitializer starting up Log4j in Servlet 3.0+ 
>> environment.
>> 
>> 22:48:01,688 INFO [io.undertow.servlet] (MSC service thread 1-11) No Log4j 
>> context configuration provided. This is very unusual.
>> 
>> 22:48:01,702 INFO [io.undertow.servlet] (MSC service thread 1-11) 
>> Log4jServletContextListener ensuring that Log4j starts up properly.
>> 
>> 
>> 
>> The log4j2.xml is located in classes under WEB-INF:
>> 
>> 
>> 
>> 
>> 
>>  
>> 
>>  
>> 
>>  c:/dev/oauth2.log
>> 
>>  
>> 
>>  
>> 
>>  > immediateFlush="true">
>> 
>>  
>> 
>>  %d %p %C{1.} [%t] %m%n
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>>  
>> 
>> 
>> 
>> 
>> 
>> The file is created but it is empty. When I explicitelly created LOG4J 
>> Logger, then it logs the statement to this file. But logging's Log does not 
>> work.
>> 
>> What is wrong?
>> 
>> 
>> 
>> Thanks
>> 
>> 
>> 
>> Leos
>> 
>> 
>> 
>> 
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: [ANNOUNCEMENT] Welcome Matt Sicker

2014-03-03 Thread Remko Popma
Welcome Matt!


On Mon, Mar 3, 2014 at 10:57 PM, Matt Sicker  wrote:

> Thanks guys! I'm looking forward to making more direct contributions now!
> In fact, cleaning up some unit tests was something that's been itching me
> for a while :)
>
> Matt Sicker
>
> > On Mar 3, 2014, at 7:51, Gary Gregory  wrote:
> >
> > Welcome aboard Matt. I'm looking forward to collaborating with you!
> >
> > Gary
> >
> >
> >> On Mon, Mar 3, 2014 at 8:39 AM, Ralph Goers  wrote:
> >>
> >> Welcome Matt!
> >>
> >> Ralph
> >>
> >> On Mar 2, 2014, at 11:43 PM, "Dominik Psenner" 
> >> wrote:
> >>
> >> Hi,
> >>
> >>
> >>
> >> it is my pleasure to announce to the community
> >>
> >> that Matt Sicker has joined our ranks.
> >>
> >>
> >>
> >> He made remarkable contributions to LOG4J
> >>
> >> and we all believe he is a valuable member
> >>
> >> of Apache Logging Services now and in future.
> >>
> >>
> >>
> >> Kind regards,
> >>
> >> Dominik Psenner
> >
> >
> > --
> > E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
> > Java Persistence with Hibernate, Second Edition<
> http://www.manning.com/bauer3/>
> > JUnit in Action, Second Edition 
> > Spring Batch in Action 
> > Blog: http://garygregory.wordpress.com
> > Home: http://garygregory.com/
> > Tweet! http://twitter.com/GaryGregory
>
> -
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>
>


Re: [ANNOUNCEMENT] Welcome Matt Sicker

2014-03-03 Thread Remko Popma
Here you are:

To subscribe to the list, send a message to:
  

Remko


On Tuesday, March 4, 2014, Matt Sicker  wrote:

> So is there a commits mailing list or something I should know about?
>
>
> On 3 March 2014 08:22, Nick Williams 
> >
> wrote:
>
> > Congratulations, Matt! Welcome aboard!
> >
> > Nick
> >
> > On Mar 3, 2014, at 8:20 AM, Remko Popma wrote:
> >
> > > Welcome Matt!
> > >
> > >
> > > On Mon, Mar 3, 2014 at 10:57 PM, Matt Sicker 
> > > >
> wrote:
> > >
> > >> Thanks guys! I'm looking forward to making more direct contributions
> > now!
> > >> In fact, cleaning up some unit tests was something that's been itching
> > me
> > >> for a while :)
> > >>
> > >> Matt Sicker
> > >>
> > >>> On Mar 3, 2014, at 7:51, Gary Gregory 
> > >>> >
> wrote:
> > >>>
> > >>> Welcome aboard Matt. I'm looking forward to collaborating with you!
> > >>>
> > >>> Gary
> > >>>
> > >>>
> > >>>> On Mon, Mar 3, 2014 at 8:39 AM, Ralph Goers 
> > >>>> 
> >
> > wrote:
> > >>>>
> > >>>> Welcome Matt!
> > >>>>
> > >>>> Ralph
> > >>>>
> > >>>> On Mar 2, 2014, at 11:43 PM, "Dominik Psenner" 
> > >>>> 
> >
> > >>>> wrote:
> > >>>>
> > >>>> Hi,
> > >>>>
> > >>>>
> > >>>>
> > >>>> it is my pleasure to announce to the community
> > >>>>
> > >>>> that Matt Sicker has joined our ranks.
> > >>>>
> > >>>>
> > >>>>
> > >>>> He made remarkable contributions to LOG4J
> > >>>>
> > >>>> and we all believe he is a valuable member
> > >>>>
> > >>>> of Apache Logging Services now and in future.
> > >>>>
> > >>>>
> > >>>>
> > >>>> Kind regards,
> > >>>>
> > >>>> Dominik Psenner
> > >>>
> > >>>
> > >>> --
> > >>> E-Mail: garydgreg...@gmail.com  | 
> > >>> ggreg...@apache.org
> > >>> Java Persistence with Hibernate, Second Edition<
> > >> http://www.manning.com/bauer3/>
> > >>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> > >>> Spring Batch in Action <http://www.manning.com/templier/>
> > >>> Blog: http://garygregory.wordpress.com
> > >>> Home: http://garygregory.com/
> > >>> Tweet! http://twitter.com/GaryGregory
> > >>
> > >> -
> > >> To unsubscribe, e-mail: 
> > >> log4j-user-unsubscr...@logging.apache.org
> > >> For additional commands, e-mail: 
> > >> log4j-user-h...@logging.apache.org
> > >>
> > >>
> >
> >
>
>
> --
> Matt Sicker >
>


Re: log4j2 2.0-rc1 issues on AIX

2014-03-18 Thread Remko Popma
As tweeted, I suggest trying the blocking wait strategy. Can you run a jstack 
dump (and perhaps attach result to a Jira ticket)? In the attached stack trace 
below, the AsyncLoggerConfig-1 thread seems to be parked, waiting for a new log 
event... Doesn't explain high CPU usage... 

Sent from my iPhone

> On 2014/03/19, at 10:27, Chris Graham  wrote:
> 
> Hello Everyone.
> 
> In this instance, I'm in indirect used of log4j2 2.0-rc1, as it's in the
> web app that I'm using, Apache Archiva 2.0.1.
> 
> The issue is that when running under WebSphere 8.5.0.2 (obviously on the
> IBM JDK, 1.6) on AIX 6.1 TL8, Apache Archiva when it's doing nothing, is
> sitting idle on around 50% CPU.
> 
> Obviosuly, this is not good!
> 
> I've performed the AIX native analysis, to get the native thread ID, mapped
> it to a Java thread it, triggered a heap dump, and I've found this as the
> culprit:
> 
> 3XMTHREADINFO  "AsyncLoggerConfig-1" J9VMThread:0x31D14600,
> j9thread_t:0x0100137D8BD0, java/lang/Thread:0x4301C508,
> state:CW, prio=5
> 3XMJAVALTHREAD(java/lang/Thread getId:0x6A, isDaemon:true)
> 3XMTHREADINFO1(native thread ID:0x2BF00F9, native priority:0x5,
> native policy:UNKNOWN)
> 3XMHEAPALLOC Heap bytes allocated since last GC cycle=0 (0x0)
> 3XMTHREADINFO3   Java callstack:
> 4XESTACKTRACEat sun/misc/Unsafe.park(Native Method)
> 4XESTACKTRACEat
> java/util/concurrent/locks/LockSupport.parkNanos(LockSupport.java:332)
> 4XESTACKTRACEat
> com/lmax/disruptor/SleepingWaitStrategy.applyWaitMethod(SleepingWaitStrategy.java:66)
> 4XESTACKTRACEat
> com/lmax/disruptor/SleepingWaitStrategy.waitFor(SleepingWaitStrategy.java:39)
> 4XESTACKTRACEat
> com/lmax/disruptor/ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:55)
> 4XESTACKTRACEat
> com/lmax/disruptor/BatchEventProcessor.run(BatchEventProcessor.java:115)
> 4XESTACKTRACEat
> java/util/concurrent/ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
> 4XESTACKTRACEat
> java/util/concurrent/ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
> 4XESTACKTRACEat java/lang/Thread.run(Thread.java:773)
> 3XMTHREADINFO3   Native callstack:
> 4XENATIVESTACK   _event_wait+0x2b8 (0x097E7D3C
> [libpthreads.a+0x16d3c])
> 4XENATIVESTACK   _cond_wait_local+0x4e4 (0x097F5A48
> [libpthreads.a+0x24a48])
> 4XENATIVESTACK   _cond_wait+0xbc (0x097F6020
> [libpthreads.a+0x25020])
> 4XENATIVESTACK   pthread_cond_wait+0x1a8 (0x097F6C8C
> [libpthreads.a+0x25c8c])
> 4XENATIVESTACK   (0x090001223014 [libj9thr26.so+0x6014])
> 4XENATIVESTACK   (0x090001222C60 [libj9thr26.so+0x5c60])
> 4XENATIVESTACK   (0x09000116AE58 [libj9vm26.so+0xfe58])
> 4XENATIVESTACK   (0x09000116B17C [libj9vm26.so+0x1017c])
> 4XENATIVESTACK   (0x090001810528 [libjclscar_26.so+0x5c528])
> 4XENATIVESTACK   (0x090001813B98 [libjclscar_26.so+0x5fb98])
> 4XENATIVESTACK   (0x090001161764 [libj9vm26.so+0x6764])
> 4XENATIVESTACK   (0x090001239CA0 [libj9prt26.so+0x2ca0])
> 4XENATIVESTACK   (0x0900011615D4 [libj9vm26.so+0x65d4])
> 4XENATIVESTACK   (0x09000121FAF4 [libj9thr26.so+0x2af4])
> 4XENATIVESTACK   _pthread_body+0xf0 (0x097D4D34
> [libpthreads.a+0x3d34])
> NULL
> 
> I've been dealing with Olivier, from Archiva, and he suggested that I drop
> a message in here.
> 
> Are there any known issues with this?
> 
> -Chris

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: log4j2 2.0-rc1 issues on AIX

2014-03-18 Thread Remko Popma
Just to double-check: when using blocking wait, and running jstack, does 
BlockingWaitStrategy appear in the stack trace? 
Also, it it possible to double-check (perhaps attach VisualVM) that it 
definitely is the AsyncLoggerConfig-1 thread that consumes so much CPU? 


Sent from my iPhone

> On 2014/03/19, at 12:31, Chris Graham  wrote:
> 
> I have tried both Block and Sleep (the default), but not Yield. No
> discernable difference.
> 
> 
>> On Wed, Mar 19, 2014 at 1:53 PM, Remko Popma  wrote:
>> 
>> As tweeted, I suggest trying the blocking wait strategy. Can you run a
>> jstack dump (and perhaps attach result to a Jira ticket)? In the attached
>> stack trace below, the AsyncLoggerConfig-1 thread seems to be parked,
>> waiting for a new log event... Doesn't explain high CPU usage...
>> 
>> Sent from my iPhone
>> 
>>> On 2014/03/19, at 10:27, Chris Graham  wrote:
>>> 
>>> Hello Everyone.
>>> 
>>> In this instance, I'm in indirect used of log4j2 2.0-rc1, as it's in the
>>> web app that I'm using, Apache Archiva 2.0.1.
>>> 
>>> The issue is that when running under WebSphere 8.5.0.2 (obviously on the
>>> IBM JDK, 1.6) on AIX 6.1 TL8, Apache Archiva when it's doing nothing, is
>>> sitting idle on around 50% CPU.
>>> 
>>> Obviosuly, this is not good!
>>> 
>>> I've performed the AIX native analysis, to get the native thread ID,
>> mapped
>>> it to a Java thread it, triggered a heap dump, and I've found this as the
>>> culprit:
>>> 
>>> 3XMTHREADINFO  "AsyncLoggerConfig-1" J9VMThread:0x31D14600,
>>> j9thread_t:0x0100137D8BD0, java/lang/Thread:0x4301C508,
>>> state:CW, prio=5
>>> 3XMJAVALTHREAD(java/lang/Thread getId:0x6A, isDaemon:true)
>>> 3XMTHREADINFO1(native thread ID:0x2BF00F9, native
>> priority:0x5,
>>> native policy:UNKNOWN)
>>> 3XMHEAPALLOC Heap bytes allocated since last GC cycle=0 (0x0)
>>> 3XMTHREADINFO3   Java callstack:
>>> 4XESTACKTRACEat sun/misc/Unsafe.park(Native Method)
>>> 4XESTACKTRACEat
>>> java/util/concurrent/locks/LockSupport.parkNanos(LockSupport.java:332)
>>> 4XESTACKTRACEat
>> com/lmax/disruptor/SleepingWaitStrategy.applyWaitMethod(SleepingWaitStrategy.java:66)
>>> 4XESTACKTRACEat
>> com/lmax/disruptor/SleepingWaitStrategy.waitFor(SleepingWaitStrategy.java:39)
>>> 4XESTACKTRACEat
>> com/lmax/disruptor/ProcessingSequenceBarrier.waitFor(ProcessingSequenceBarrier.java:55)
>>> 4XESTACKTRACEat
>>> com/lmax/disruptor/BatchEventProcessor.run(BatchEventProcessor.java:115)
>>> 4XESTACKTRACEat
>> java/util/concurrent/ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
>>> 4XESTACKTRACEat
>> java/util/concurrent/ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
>>> 4XESTACKTRACEat java/lang/Thread.run(Thread.java:773)
>>> 3XMTHREADINFO3   Native callstack:
>>> 4XENATIVESTACK   _event_wait+0x2b8 (0x097E7D3C
>>> [libpthreads.a+0x16d3c])
>>> 4XENATIVESTACK   _cond_wait_local+0x4e4 (0x097F5A48
>>> [libpthreads.a+0x24a48])
>>> 4XENATIVESTACK   _cond_wait+0xbc (0x097F6020
>>> [libpthreads.a+0x25020])
>>> 4XENATIVESTACK   pthread_cond_wait+0x1a8 (0x097F6C8C
>>> [libpthreads.a+0x25c8c])
>>> 4XENATIVESTACK   (0x090001223014 [libj9thr26.so+0x6014])
>>> 4XENATIVESTACK   (0x090001222C60 [libj9thr26.so+0x5c60])
>>> 4XENATIVESTACK   (0x09000116AE58 [libj9vm26.so+0xfe58])
>>> 4XENATIVESTACK   (0x09000116B17C [libj9vm26.so+0x1017c])
>>> 4XENATIVESTACK   (0x090001810528
>> [libjclscar_26.so+0x5c528])
>>> 4XENATIVESTACK   (0x090001813B98
>> [libjclscar_26.so+0x5fb98])
>>> 4XENATIVESTACK   (0x090001161764 [libj9vm26.so+0x6764])
>>> 4XENATIVESTACK   (0x090001239CA0 [libj9prt26.so+0x2ca0])
>>> 4XENATIVESTACK   (0x0900011615D4 [libj9vm26.so+0x65d4])
>>> 4XENATIVESTACK   (0x09000121FAF4 [libj9thr26.so+0x2af4])
>>> 4XENATIVESTACK   _pthread_body+0xf0 (0x097D4D34
>>> [libpthreads.a+0x3d34])
>>> NULL
>>> 
>>> I've been dealing with Olivier, from Archiva, and he suggested that I
>> drop
>>> a message in here.
>>> 
>>> Are there any known issues with this?
>>> 
>>> -Chris
>> 
>> -
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>> 
>> 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: log4j2 2.0-rc1 issues on AIX

2014-03-20 Thread Remko Popma
 _event_wait+0x2b8 (0x097E7D3C
>> [libpthreads.a+0x16d3c])
>> 4XENATIVESTACK   _cond_wait_local+0x4e4 (0x0900007F5A48
>> [libpthreads.a+0x24a48])
>> 4XENATIVESTACK   _cond_wait+0xbc (0x097F6020
>> [libpthreads.a+0x25020])
>> 4XENATIVESTACK   pthread_cond_wait+0x1a8 (0x097F6C8C
>> [libpthreads.a+0x25c8c])
>> 4XENATIVESTACK   (0x090001223014 [libj9thr26.so+0x6014])
>> 4XENATIVESTACK   (0x090001222C60 [libj9thr26.so+0x5c60])
>> 4XENATIVESTACK   (0x09000116AE58 [libj9vm26.so+0xfe58])
>> 4XENATIVESTACK   (0x09000116B17C [libj9vm26.so+0x1017c])
>> 4XENATIVESTACK   (0x090001810528
>> [libjclscar_26.so+0x5c528])
>> 4XENATIVESTACK   (0x090001813B98
>> [libjclscar_26.so+0x5fb98])
>> 4XENATIVESTACK   (0x090001161764 [libj9vm26.so+0x6764])
>> 4XENATIVESTACK   (0x090001239CA0 [libj9prt26.so+0x2ca0])
>> 4XENATIVESTACK   (0x0900011615D4 [libj9vm26.so+0x65d4])
>> 4XENATIVESTACK   (0x09000121FAF4 [libj9thr26.so+0x2af4])
>> 4XENATIVESTACK   _pthread_body+0xf0 (0x097D4D34
>> [libpthreads.a+0x3d34])
>> NULL
>> 
>> Would you like me to attach the complete sleep.tprof and javacore.txt file
>> to the Jira ticket that I just created?
>> 
>> https://issues.apache.org/jira/browse/LOG4J2-571
>> 
>> Thanks for looking, this has been driving me nuts.
>> 
>> -Chris
>> 
>> 
>> 
>> On Wed, Mar 19, 2014 at 2:45 PM, Remko Popma 
>> wrote:
>> 
>>> Just to double-check: when using blocking wait, and running jstack, does
>>> BlockingWaitStrategy appear in the stack trace?
>>> Also, it it possible to double-check (perhaps attach VisualVM) that it
>>> definitely is the AsyncLoggerConfig-1 thread that consumes so much CPU?
>>> 
>>> 
>>> Sent from my iPhone
>>> 
>>>> On 2014/03/19, at 12:31, Chris Graham  wrote:
>>>> 
>>>> I have tried both Block and Sleep (the default), but not Yield. No
>>>> discernable difference.
>>>> 
>>>> 
>>>>> On Wed, Mar 19, 2014 at 1:53 PM, Remko Popma 
>>> wrote:
>>>>> 
>>>>> As tweeted, I suggest trying the blocking wait strategy. Can you run a
>>>>> jstack dump (and perhaps attach result to a Jira ticket)? In the
>>> attached
>>>>> stack trace below, the AsyncLoggerConfig-1 thread seems to be parked,
>>>>> waiting for a new log event... Doesn't explain high CPU usage...
>>>>> 
>>>>> Sent from my iPhone
>>>>> 
>>>>>> On 2014/03/19, at 10:27, Chris Graham  wrote:
>>>>>> 
>>>>>> Hello Everyone.
>>>>>> 
>>>>>> In this instance, I'm in indirect used of log4j2 2.0-rc1, as it's in
>>> the
>>>>>> web app that I'm using, Apache Archiva 2.0.1.
>>>>>> 
>>>>>> The issue is that when running under WebSphere 8.5.0.2 (obviously on
>>> the
>>>>>> IBM JDK, 1.6) on AIX 6.1 TL8, Apache Archiva when it's doing nothing,
>>> is
>>>>>> sitting idle on around 50% CPU.
>>>>>> 
>>>>>> Obviosuly, this is not good!
>>>>>> 
>>>>>> I've performed the AIX native analysis, to get the native thread ID,
>>>>> mapped
>>>>>> it to a Java thread it, triggered a heap dump, and I've found this as
>>> the
>>>>>> culprit:
>>>>>> 
>>>>>> 3XMTHREADINFO  "AsyncLoggerConfig-1"
>> J9VMThread:0x31D14600,
>>>>>> j9thread_t:0x0100137D8BD0, java/lang/Thread:0x4301C508,
>>>>>> state:CW, prio=5
>>>>>> 3XMJAVALTHREAD(java/lang/Thread getId:0x6A,
>> isDaemon:true)
>>>>>> 3XMTHREADINFO1(native thread ID:0x2BF00F9, native
>>>>> priority:0x5,
>>>>>> native policy:UNKNOWN)
>>>>>> 3XMHEAPALLOC Heap bytes allocated since last GC cycle=0
>>> (0x0)
>>>>>> 3XMTHREADINFO3   Java callstack:
>>>>>> 4XESTACKTRACEat sun/misc/Unsafe.park(Native Method)
>>>>>> 4XESTACKTRACEat
>> java/util/concurrent/locks/LockSupport.parkNanos(LockSupport.java:332)
>>>>>> 4XESTACKTRACEat
>> com/lmax/disruptor/SleepingWaitStrategy.applyWaitMethod(SleepingWaitStrategy.java:66)
>>>>>> 4XESTACKTRACE
> 
> 
> 
> -- 
> Matt Sicker 

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



Re: log4j2 2.0-rc1 issues on AIX

2014-03-20 Thread Remko Popma
Took another look at the Disruptor SleepingWait strategy. It actually uses
a back-off strategy. From the javadoc:

Sleeping strategy that initially spins, then uses a Thread.yield(), and
eventually for the minimum number of nanos the OS and JVM will allow while
the {@link com.lmax.disruptor.EventProcessor}s are waiting on a barrier.
This strategy is a good compromise between performance and CPU resource.
Latency spikes can occur after quiet periods.

The Disruptor SleepingWait strategy code eventually calls LockSupport.
parkNanos(1L);
Different platforms have different timer resolution (I think Windows cannot
go smaller than ~15 millis), and it is possible that AIX has a more
accurate clock.

I'm beginning to think perhaps BlockingWait should be the default for log4j.

On Fri, Mar 21, 2014 at 9:33 AM, Chris Graham  wrote:

> The AIX system clock is not the same base time as most Intel boxes. What is
> the sleep time in the sleep strategy? If it's being derived, it might be
> too small. ???
>
> Just a thought.
>
> To further complicate matters, this particular lpar was uncapped, which
> means that it can steal CPU from other lpars that are not as busy. So the
> number of active CPU's can dynamically vary.
>
> -Chris
>
>
>
> On Fri, Mar 21, 2014 at 9:01 AM, Remko Popma 
> wrote:
>
> > No, it turned out that the docs for Apache Archiva were incorrect and the
> > WaitStrategy was effectively still SleepingWaitStrategy. Using the
> correct
> > config to specify BlockingWaitStrategy solved the issue. (LOG4J2-571)
> >
> > FYI, the wait strategy determines what the consumer thread does when the
> > queue is empty & it's waiting for events. Some specialized apps want to
> > avoid the latency of waking up a blocked thread, so there are a number of
> > options with different trade-offs, with busy spin on one end of the
> > spectrum and blocking on the other. For log4j I reduced the set of
> > available options (no busy spin), and choose  SleepingWait as the
> default.
> > This had the best performance in my testing. Until now I hadn't seen any
> > excessive CPU usage.
> >
> > Sent from my iPhone
> >
> > > On 2014/03/20, at 22:10, Matt Sicker  wrote:
> > >
> > > Perhaps lmax disruptor doesn't work properly in the IBM JVM?
> > >
> > >> On Tuesday, 18 March 2014, Chris Graham  wrote:
> > >>
> > >> JStack is a Sun thing. This is the IBM JDK on AIX.
> > >> I've run the tprof command twice and verified it.
> > >>
> > >> The full work though follows.
> > >>
> > >> The output from topas (same as top, effectively) is:
> > >>
> > >> Topas Monitor for host:XXX  EVENTS/QUEUES
> >  FILE/TTY
> > >> Wed Mar 19 14:49:55 2014   Interval:  2 Cswitch3581
> > >> Readch  686
> > >>Syscall2763
>  Writech
> > >> 1378
> > >> CPU  User%  Kern%  Wait%  Idle%  Physc   Entc   Reads 7
> > >> Rawin 0
> > >> ALL   48.81.20.0   50.1   1.03   51.7   Writes5
> > >> Ttyout  643
> > >>Forks 0
> > >> Igets 0
> > >> Network  KBPS   I-Pack  O-Pack   KB-In  KB-Out  Execs 0
> > >> Namei81
> > >> Total 2.8 10.0 7.5 1.1 1.7  Runqueue1.0
> > >> Dirblk0
> > >>Waitqueue   0.0
> > >> DiskBusy% KBPS TPS KB-Read KB-Writ
> MEMORY
> > >> Total 0.0  0.0 0.0 0.0 0.0  PAGING
> Real,MB
> > >> 20480
> > >>Faults3  % Comp
> > >> 44
> > >> FileSystemKBPS TPS KB-Read KB-Writ  Steals0  %
> > Noncomp
> > >> 54
> > >> Total  0.6 1.50.60.0PgspIn0  %
> > Client
> > >> 54
> > >>PgspOut   0
> > >> NamePID  CPU%  PgSp Owner   PageIn0
>  PAGING
> > >> SPACE
> > >> java9437312  48.6 739.1 wasadminPageOut   0
>  Size,MB
> > >> 15552
> > >>
> > >> Process with a PID of 9437312 is the WebSphere instance that runs
> > Archiva,
> > >> the problem in question.
> > >>
> > >> We then use a nati

Re: permissions on log files that RollingFileAppender creates

2014-03-26 Thread Remko Popma
What is the java version used in 10.1.3.5.0 Oracle-HTTP-Server and in  the
older version?

Sent from my iPhone

On Thursday, March 27, 2014,  wrote:

> In my log4j.properties, it is configured to use
>
> log4j.appender.logfile=org.apache.log4j.RollingFileAppender
>
> In previous versions, the log files it auto-created had 660 (rw-rw)
> permissions,
> but now it seems to create them with 640 (rw-r-).
>
> Is there a property I can set within the log4j.properties file to tell
> the file appender what permissions to create the new log files with?
>
> I am working with an Oracle supplied Apache server.
> Oracle-Application-Server-10g/10.1.3.5.0 Oracle-HTTP-Server
>
> The previous versions were 10.1.2.x.x that created the log files with the
> desired 660 permissions.
> Due to patching level requirements, I have to be at the 10.1.3.5.0 level.
>
>
> -
> To unsubscribe, e-mail: 
> log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: 
> log4j-user-h...@logging.apache.org
>
>


Re: Running disruptor async performance tests

2014-03-29 Thread Remko Popma
Hi Becky,

The performance test code is a bit messy. Apologies for that.

To answer your questions: I used the longer message for throughput tests,
and the shorter message for latency tests.
PerfTest parameters:
[0] = runner class (like org.apache.logging.log4j.core.
async.perftest.RunLog4j2)
[1] = (blah) is the test name (like "Loggers all async") printed to the
console when a test is started.
[2] = file name to write results to
[3] = thread count (default=3)
followed by optional parameters -verbose and -throughput.

The current implementation of PerfTest runs one throughput and one latency
test, regardless of whether -throughput is specified.

The PerfTestDriver class is the start point for all tests. It sets up
various things like classpath, and system properties to control various
things for different tests. If you use the PerfTest class directly you need
to set up these parameters manually:
-Dlog4j.configurationFile=perf3PlainNoLoc.xml
-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector

The  perf3PlainNoLoc.xml config determines the log file.
The PerfTestDriver would automatically delete this file after each run, you
probably want to do this manually.

Hope this helps,
Remko



On Sat, Mar 29, 2014 at 12:03 PM, Rebecca Ahlvarsson
wrote:

> I am trying to run the async performance tests described on the link below
> on my machine.
>
>
> http://logging.apache.org/log4j/2.x/manual/async.html#Asynchronous_Logging_Performance
>
> I am not an expert with log4j, so here is how far I got after building
> log4j with maven:
>
> java -cp
>
> target/classes:target/test-classes:lib/disruptor-3.2.1.jar:../log4j-api/target/classes
> org.apache.logging.log4j.core.async.perftest.PerfTest
> org.apache.logging.log4j.core.async.perftest.RunLog4j2 blah blah.log 1
> -verbose
>
> Then I get this in the output:
>
> avg=17 99%=32 99.99%=64 sampleCount=500
> 9962247 operations/second
>
> The questions I have are:
>
> 1. It looks like the source code IPerfTestRunner uses a much shorter
> message "Short Msg" instead of the 500 characters message stated in the
> link above. Is that intentional or is it a bug? Do we want to test the
> latency with the 500-character message or just a short message?
>
> 2. I notice that my logs are NOT going to any file. I am probably
> misconfiguring something with log4j. How do I generate a file with the
> messages from the performance test?
>
> 3. I just want to test with one asynchronous logging thread, so I am
> passing threadCount 1 above. What does the second parameter 'blah' mean?
>
> 4. Not sure why I get operations/seconds if I am not passing -throughput in
> the command-line. I just want to get the latency numbers for now. After
> that I will worry about throughput.
>
> So basically I just want to run the same test you run to see those great
> numbers on my production machine.
>
> Thanks for the help!
>
> -Becky
>


Re: Running disruptor async performance tests

2014-03-29 Thread Remko Popma
gt; avg=102 99%=256 99.99%=2048 sampleCount=500
> 3500849 operations/second
> avg=65 99%=256 99.99%=2048 sampleCount=500
> 3143970 operations/second
> throughput: 4,497,168 ops/sec. latency(ns): avg=108.0 99% < 256.0 99.99% <
> 1638.4 (2500 samples)
> -
> Log4j2: Loggers mixed sync/async (single thread) (1/5)... (2/5)... (3/5)...
> (4/5)... (5/5)... took 322.6 seconds
> avg=214 99%=512 99.99%=2048 sampleCount=500
> 4257812 operations/second
> avg=217 99%=256 99.99%=2048 sampleCount=500
> 3027177 operations/second
> avg=271 99%=512 99.99%=2048 sampleCount=500
> 4304127 operations/second
> avg=217 99%=512 99.99%=2048 sampleCount=500
> 3008435 operations/second
> avg=223 99%=512 99.99%=2048 sampleCount=500
> 543 operations/second
> throughput: 4,005,510 ops/sec. latency(ns): avg=228.4 99% < 460.8 99.99% <
> 2048.0 (2500 samples)
> -
>
>
>
> On Sat, Mar 29, 2014 at 3:46 AM, Remko Popma 
> wrote:
>
> > Hi Becky,
> >
> > The performance test code is a bit messy. Apologies for that.
> >
> > To answer your questions: I used the longer message for throughput tests,
> > and the shorter message for latency tests.
> > PerfTest parameters:
> > [0] = runner class (like org.apache.logging.log4j.core.
> > async.perftest.RunLog4j2)
> > [1] = (blah) is the test name (like "Loggers all async") printed to the
> > console when a test is started.
> > [2] = file name to write results to
> > [3] = thread count (default=3)
> > followed by optional parameters -verbose and -throughput.
> >
> > The current implementation of PerfTest runs one throughput and one
> latency
> > test, regardless of whether -throughput is specified.
> >
> > The PerfTestDriver class is the start point for all tests. It sets up
> > various things like classpath, and system properties to control various
> > things for different tests. If you use the PerfTest class directly you
> need
> > to set up these parameters manually:
> > -Dlog4j.configurationFile=perf3PlainNoLoc.xml
> >
> >
> -DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
> >
> > The  perf3PlainNoLoc.xml config determines the log file.
> > The PerfTestDriver would automatically delete this file after each run,
> you
> > probably want to do this manually.
> >
> > Hope this helps,
> > Remko
> >
> >
> >
> > On Sat, Mar 29, 2014 at 12:03 PM, Rebecca Ahlvarsson
> > wrote:
> >
> > > I am trying to run the async performance tests described on the link
> > below
> > > on my machine.
> > >
> > >
> > >
> >
> http://logging.apache.org/log4j/2.x/manual/async.html#Asynchronous_Logging_Performance
> > >
> > > I am not an expert with log4j, so here is how far I got after building
> > > log4j with maven:
> > >
> > > java -cp
> > >
> > >
> >
> target/classes:target/test-classes:lib/disruptor-3.2.1.jar:../log4j-api/target/classes
> > > org.apache.logging.log4j.core.async.perftest.PerfTest
> > > org.apache.logging.log4j.core.async.perftest.RunLog4j2 blah blah.log 1
> > > -verbose
> > >
> > > Then I get this in the output:
> > >
> > > avg=17 99%=32 99.99%=64 sampleCount=500
> > > 9962247 operations/second
> > >
> > > The questions I have are:
> > >
> > > 1. It looks like the source code IPerfTestRunner uses a much shorter
> > > message "Short Msg" instead of the 500 characters message stated in the
> > > link above. Is that intentional or is it a bug? Do we want to test the
> > > latency with the 500-character message or just a short message?
> > >
> > > 2. I notice that my logs are NOT going to any file. I am probably
> > > misconfiguring something with log4j. How do I generate a file with the
> > > messages from the performance test?
> > >
> > > 3. I just want to test with one asynchronous logging thread, so I am
> > > passing threadCount 1 above. What does the second parameter 'blah'
> mean?
> > >
> > > 4. Not sure why I get operations/seconds if I am not passing
> -throughput
> > in
> > > the command-line. I just want to get the latency numbers for now. After
> > > that I will worry about throughput.
> > >
> > > So basically I just want to run the same test you run to see those
> great
> > > numbers on my production machine.
> > >
> > > Thanks for the help!
> > >
> > > -Becky
> > >
> >
>
>
>
> --
> -Becky
>


Re: Unit testing log4j JMS Appender

2014-04-02 Thread Remko Popma
The problem is in  activemq-all-5.9.0.jar. I suggest you contact the activemq 
team. 

Sent from my iPhone

> On 2014/04/03, at 2:53, Gary Gregory  wrote:
> 
> activemq-all-5.9.0.jar

-
To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-user-h...@logging.apache.org



  1   2   3   4   5   >