Hey Robert,

Thanks for getting back to me so quickly.

Running with debug helped me figure it out. It looks like the additivity stuff 
was right the way it was, but it turns out when it was parsing the log file it 
wasn't even noticing the other loggers. So I looked even closer and noticed 
that I was saying "log4" instead of "log4j" just on the lines where I was 
defining sender and receiver. I can't believe I didn't see that before posting, 
but thank you for helping me find it.

Best,
Nathan Eisenberg

-----Original Message-----
From: Robert Middleton <rmiddle...@apache.org> 
Sent: Thursday, December 1, 2022 7:31 AM
To: dev@logging.apache.org
Subject: EXTERNAL: Re: Non-Root Logger Logging Problems

Hi Nathan,

My guess would be that additivity.sender=false should actually be 
sender.additivity=false.

As to why the log messages are not going to the second FileAppender, I'm not 
sure why that would be happening.  I would recommend running with internal 
debugging enabled.  You can do this by setting log4j.debug=true in your config 
file.

-Robert Middleton



On Wed, Nov 30, 2022 at 11:41 PM Eisenberg, Nathan <nathan.eisenb...@lmco.com> 
wrote:
>
> I have configured 2 loggers inside my java config file: 1 is the rootLogger 
> and it has 2 appenders, and the other is called sender and it has 1 appender.
>
>
> My java config file looks something like this:
> rootLogger= [level], consoleAppender, fileAppender1
>
> sender=[level], fileAppender2
> additivity.sender=false
>
> consoleAppender=log4j.consoleAppender
> layout stuff...
>
> fileAppender1=log4j.RollingFileAppender
> file and layout details...
>
> fileAppender2=log4j.RollingFileAppender
> file and layout details...
>
>
> And in my c++ code I'm using it like this:
> Logger rootLogger = getLogger("root"); LOG4CXX_INFO(rootLogger, 
> "message");
>
> Logger senderLogger = getLogger("sender"); LOG4CXX_INFO(senderLogger, 
> "otherMessage");
>
>
> Although the rootAppender works perfectly fine, my problem is that the 
> sender's message (otherMessage) is only showing up in the rootLogger's 
> appenders (consoleAppender, fileAppender1) but NOT it's own appender 
> (fileAppender2). Does anyone have any idea what I'm doing wrong?
>
>
> Nathan Eisenberg
>

Reply via email to