You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by DE BENEDICTIS DAVIDE <dd...@sogei.it> on 2005/02/28 16:57:30 UTC

Suggestions... (modifying logging messages on the fly)

Hi,
I have a working application that uses an SMTP appender.
This appendere is used for administration purposes. Only for certain
fatal exceptions, a mail is sent toward the support team.
Now, for the same events, I have to send short messages (SMS) using
another SMTP appender (we have a mail server which transforms incoming
mail messages into SMS and it forwards them to a configured cell phones
list).
I tought to add another appender using the same logger but given the sms
size restrictions (not more than 160 chars) I cannot send a full stack
trace.
I'm looking for a method to modifying (cutting) the outcoming logging
message on the fly. In this way I could update only the log4j conf files
without touching my working app.
Something like a %m with the ability to specify a maximum number of
chars.
I looked into the docs but I didn't find anything.

Any suggestion?

Thank you in advance 

--
Davide De Benedictis


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


Re: Suggestions... (modifying logging messages on the fly)

Posted by Curt Arnold <ca...@apache.org>.
On Feb 28, 2005, at 10:26 AM, James Stauffer wrote:

> DE BENEDICTIS DAVIDE <dd...@sogei.it> wrote:
>>
>> I'm looking for a method to modifying (cutting) the outcoming logging
>> message on the fly. In this way I could update only the log4j conf 
>> files
>> without touching my working app.
>> Something like a %m with the ability to specify a maximum number of
>> chars.
>>

Have you tried "%.80m" or similar?  That should specify a maximum 
message length of 80 characters. If the message is longer it will be 
truncated from the beginning.


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


Re: Suggestions... (modifying logging messages on the fly)

Posted by James Stauffer <st...@gmail.com>.
DE BENEDICTIS DAVIDE <dd...@sogei.it> wrote:
> 
> I'm looking for a method to modifying (cutting) the outcoming logging
> message on the fly. In this way I could update only the log4j conf files
> without touching my working app.
> Something like a %m with the ability to specify a maximum number of
> chars.

When I email my SMS email address it automatically cuts off anything
over 160 characters so maybe you don't need to do anything besides
making sure that the order of info is correct.


-- 
James Stauffer
http://www.geocities.com/stauffer_james/

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