You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by timprepscius <ti...@piratemail.se> on 2012/07/13 17:42:50 UTC
logging code style
So I'm running into a set of problems while trying to manipulate the apache james logs.
I'm not sure if I'm approaching the solution incorrectly or whether the way you're passing around the session log is going to make things pretty difficult.
Basically I need to shut off some logs, and keep others on.
But I'm finding that I basically have on/off for entire services.
So you know how there are logs for SMTP:
StringBuilder infoBuffer = new StringBuilder(256).append("Successfully spooled mail ").append(mail.getName()).append(" fro
I need to turn off all logs which have identifying information.
But. I want to keep some, like for instance, connection from ip.
In the future I want to turn these off as well, but I need to know something of what is happening :-)
How I was thinking I would do this, is lookup which classes the logs were originating from and then scuttle those classes via log4j.
But it seems with the session log being passed around this becomes impossible?
So I'm going to have to turn the log4j everything to FATAL
and then go in and change the code for all the logs I actually want.
Or am I missing something here :-)
I probably am.
I hope I am actually.
I was hoping to keep the code changes to a bare minimum.
-tim
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
Re: logging code style
Posted by timprepscius <ti...@piratemail.se>.
Don't worry about it! Lol. :-)
I'm just giving usage feed back.
Have a good weekend.
-tim
On Jul 13, 2012, at 5:52 PM, Ioan Eugen Stan wrote:
> 2012/7/13 timprepscius <ti...@piratemail.se>:
>> Yah, this is exactly what I wanted to do.
>>
>> However I'm not sure this is possible because of session.getLog();
>>
>> Anyhow, it's no big deal.
>> I'll just put custom
>> static Log log = LogFactory.getLogger(TheClassImIn.class)
>> in the files for which I want logging.
>
> Hi,
>
> I think it's a good reason for that. I'm too tired to look at the code
> right now but my guess is to keep the log consistent. Not really sure,
> tired.
>
> Cheers,
>
>>
>> If in a later design you have the choice of not doing the session.getLog(), perhaps it would be the better choice?
>> (or there is still a chance I am completely missing the boat here)
>>
>> -tim
>>
>>
>> On Jul 13, 2012, at 3:13 PM, Ioan Eugen Stan wrote:
>>
>>> Hi,
>>>
>>> Not sure is off-topic but maybe this could help a bit:
>>>
>>> - http://stackoverflow.com/questions/2763740/log4j-log-output-of-a-specific-class-to-a-specific-appender
>>> - http://stackoverflow.com/questions/1460740/log4j-for-per-class-how-is-precedence-determined
>>>
>>> Good luck,
>>>
>>> 2012/7/13 timprepscius <ti...@piratemail.se>:
>>>> So I'm running into a set of problems while trying to manipulate the apache james logs.
>>>>
>>>>
>>>> I'm not sure if I'm approaching the solution incorrectly or whether the way you're passing around the session log is going to make things pretty difficult.
>>>>
>>>>
>>>> Basically I need to shut off some logs, and keep others on.
>>>> But I'm finding that I basically have on/off for entire services.
>>>>
>>>>
>>>> So you know how there are logs for SMTP:
>>>>
>>>> StringBuilder infoBuffer = new StringBuilder(256).append("Successfully spooled mail ").append(mail.getName()).append(" fro
>>>> I need to turn off all logs which have identifying information.
>>>> But. I want to keep some, like for instance, connection from ip.
>>>>
>>>> In the future I want to turn these off as well, but I need to know something of what is happening :-)
>>>>
>>>>
>>>>
>>>> How I was thinking I would do this, is lookup which classes the logs were originating from and then scuttle those classes via log4j.
>>>> But it seems with the session log being passed around this becomes impossible?
>>>>
>>>>
>>>> So I'm going to have to turn the log4j everything to FATAL
>>>> and then go in and change the code for all the logs I actually want.
>>>>
>>>>
>>>>
>>>>
>>>> Or am I missing something here :-)
>>>>
>>>> I probably am.
>>>> I hope I am actually.
>>>> I was hoping to keep the code changes to a bare minimum.
>>>>
>>>>
>>>> -tim
>>>>
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>
>>>
>>>
>>>
>>> --
>>> Ioan Eugen Stan / CTO / http://axemblr.com
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>
>
>
> --
> Ioan Eugen Stan / CTO / http://axemblr.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
Re: logging code style
Posted by Ioan Eugen Stan <st...@gmail.com>.
2012/7/13 timprepscius <ti...@piratemail.se>:
> Yah, this is exactly what I wanted to do.
>
> However I'm not sure this is possible because of session.getLog();
>
> Anyhow, it's no big deal.
> I'll just put custom
> static Log log = LogFactory.getLogger(TheClassImIn.class)
> in the files for which I want logging.
Hi,
I think it's a good reason for that. I'm too tired to look at the code
right now but my guess is to keep the log consistent. Not really sure,
tired.
Cheers,
>
> If in a later design you have the choice of not doing the session.getLog(), perhaps it would be the better choice?
> (or there is still a chance I am completely missing the boat here)
>
> -tim
>
>
> On Jul 13, 2012, at 3:13 PM, Ioan Eugen Stan wrote:
>
>> Hi,
>>
>> Not sure is off-topic but maybe this could help a bit:
>>
>> - http://stackoverflow.com/questions/2763740/log4j-log-output-of-a-specific-class-to-a-specific-appender
>> - http://stackoverflow.com/questions/1460740/log4j-for-per-class-how-is-precedence-determined
>>
>> Good luck,
>>
>> 2012/7/13 timprepscius <ti...@piratemail.se>:
>>> So I'm running into a set of problems while trying to manipulate the apache james logs.
>>>
>>>
>>> I'm not sure if I'm approaching the solution incorrectly or whether the way you're passing around the session log is going to make things pretty difficult.
>>>
>>>
>>> Basically I need to shut off some logs, and keep others on.
>>> But I'm finding that I basically have on/off for entire services.
>>>
>>>
>>> So you know how there are logs for SMTP:
>>>
>>> StringBuilder infoBuffer = new StringBuilder(256).append("Successfully spooled mail ").append(mail.getName()).append(" fro
>>> I need to turn off all logs which have identifying information.
>>> But. I want to keep some, like for instance, connection from ip.
>>>
>>> In the future I want to turn these off as well, but I need to know something of what is happening :-)
>>>
>>>
>>>
>>> How I was thinking I would do this, is lookup which classes the logs were originating from and then scuttle those classes via log4j.
>>> But it seems with the session log being passed around this becomes impossible?
>>>
>>>
>>> So I'm going to have to turn the log4j everything to FATAL
>>> and then go in and change the code for all the logs I actually want.
>>>
>>>
>>>
>>>
>>> Or am I missing something here :-)
>>>
>>> I probably am.
>>> I hope I am actually.
>>> I was hoping to keep the code changes to a bare minimum.
>>>
>>>
>>> -tim
>>>
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>>
>>
>>
>> --
>> Ioan Eugen Stan / CTO / http://axemblr.com
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
--
Ioan Eugen Stan / CTO / http://axemblr.com
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
Re: logging code style
Posted by timprepscius <ti...@piratemail.se>.
Yah, this is exactly what I wanted to do.
However I'm not sure this is possible because of session.getLog();
Anyhow, it's no big deal.
I'll just put custom
static Log log = LogFactory.getLogger(TheClassImIn.class)
in the files for which I want logging.
If in a later design you have the choice of not doing the session.getLog(), perhaps it would be the better choice?
(or there is still a chance I am completely missing the boat here)
-tim
On Jul 13, 2012, at 3:13 PM, Ioan Eugen Stan wrote:
> Hi,
>
> Not sure is off-topic but maybe this could help a bit:
>
> - http://stackoverflow.com/questions/2763740/log4j-log-output-of-a-specific-class-to-a-specific-appender
> - http://stackoverflow.com/questions/1460740/log4j-for-per-class-how-is-precedence-determined
>
> Good luck,
>
> 2012/7/13 timprepscius <ti...@piratemail.se>:
>> So I'm running into a set of problems while trying to manipulate the apache james logs.
>>
>>
>> I'm not sure if I'm approaching the solution incorrectly or whether the way you're passing around the session log is going to make things pretty difficult.
>>
>>
>> Basically I need to shut off some logs, and keep others on.
>> But I'm finding that I basically have on/off for entire services.
>>
>>
>> So you know how there are logs for SMTP:
>>
>> StringBuilder infoBuffer = new StringBuilder(256).append("Successfully spooled mail ").append(mail.getName()).append(" fro
>> I need to turn off all logs which have identifying information.
>> But. I want to keep some, like for instance, connection from ip.
>>
>> In the future I want to turn these off as well, but I need to know something of what is happening :-)
>>
>>
>>
>> How I was thinking I would do this, is lookup which classes the logs were originating from and then scuttle those classes via log4j.
>> But it seems with the session log being passed around this becomes impossible?
>>
>>
>> So I'm going to have to turn the log4j everything to FATAL
>> and then go in and change the code for all the logs I actually want.
>>
>>
>>
>>
>> Or am I missing something here :-)
>>
>> I probably am.
>> I hope I am actually.
>> I was hoping to keep the code changes to a bare minimum.
>>
>>
>> -tim
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>
>
>
> --
> Ioan Eugen Stan / CTO / http://axemblr.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org
Re: logging code style
Posted by Ioan Eugen Stan <st...@gmail.com>.
Hi,
Not sure is off-topic but maybe this could help a bit:
- http://stackoverflow.com/questions/2763740/log4j-log-output-of-a-specific-class-to-a-specific-appender
- http://stackoverflow.com/questions/1460740/log4j-for-per-class-how-is-precedence-determined
Good luck,
2012/7/13 timprepscius <ti...@piratemail.se>:
> So I'm running into a set of problems while trying to manipulate the apache james logs.
>
>
> I'm not sure if I'm approaching the solution incorrectly or whether the way you're passing around the session log is going to make things pretty difficult.
>
>
> Basically I need to shut off some logs, and keep others on.
> But I'm finding that I basically have on/off for entire services.
>
>
> So you know how there are logs for SMTP:
>
> StringBuilder infoBuffer = new StringBuilder(256).append("Successfully spooled mail ").append(mail.getName()).append(" fro
> I need to turn off all logs which have identifying information.
> But. I want to keep some, like for instance, connection from ip.
>
> In the future I want to turn these off as well, but I need to know something of what is happening :-)
>
>
>
> How I was thinking I would do this, is lookup which classes the logs were originating from and then scuttle those classes via log4j.
> But it seems with the session log being passed around this becomes impossible?
>
>
> So I'm going to have to turn the log4j everything to FATAL
> and then go in and change the code for all the logs I actually want.
>
>
>
>
> Or am I missing something here :-)
>
> I probably am.
> I hope I am actually.
> I was hoping to keep the code changes to a bare minimum.
>
>
> -tim
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>
--
Ioan Eugen Stan / CTO / http://axemblr.com
---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org