You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-dev@logging.apache.org by bu...@apache.org on 2009/01/07 00:33:14 UTC
DO NOT REPLY [Bug 46483] Truncating the end of the log message using
a PatternLayout
https://issues.apache.org/bugzilla/show_bug.cgi?id=46483
Curt Arnold <ca...@apache.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |INVALID
--- Comment #1 from Curt Arnold <ca...@apache.org> 2009-01-06 15:33:13 PST ---
It appears to be behaving as documented:
<p>This behavior can be changed using the <em>maximum field
width</em> modifier which is designated by a period followed by a
decimal constant. If the data item is longer than the maximum
field, then the extra characters are removed from the
<em>beginning</em> of the data item and not from the end. For
example, it the maximum field width is eight and the data item is
ten characters long, then the first two characters of the data item
are dropped. This behavior deviates from the printf function in C
where truncation is done from the end.
This sounds really more like a usage question and not a bug. Please ask on
log4j-user on how best to accomplish end of field truncation.
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: Consult
Posted by Curt Arnold <ca...@apache.org>.
On Jan 8, 2009, at 6:24 AM, Luciano Izquierdo wrote:
> Hi, thanks for your answer.
> But your solution is if I will have only two appenders.
> That does not serve me because I have more than two appenders, then
> if I
> change the root logger, the others appenders and loggers can be
> broken.
> I need a solution without changing de rootLogger.
> My application have many loggers and appenders.
>
> How can I do?
The same principle should work, set the level of the logger to the
lower level and the threshold of the appender with the higher level.
log4j.logger.Logger1=DEBUG,Appender1,Appender2
log4j.appender.Appender2.threshold=ERROR
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
RE: Consult
Posted by Luciano Izquierdo <li...@moviltek.com>.
-----Mensaje original-----
De: Luciano Izquierdo [mailto:lizquierdo@moviltek.com]
Enviado el: Jueves, 08 de Enero de 2009 09:25 a.m.
Para: 'Log4J Developers List'
Asunto: RE: Consult
Hi, thanks for your answer.
But your solution is if I will have only two appenders.
That does not serve me because I have more than two appenders, then if I
change the root logger, the others appenders and loggers can be broken.
I need a solution without changing de rootLogger.
My application have many loggers and appenders.
How can I do?
-----Mensaje original-----
De: Curt Arnold [mailto:carnold@apache.org]
Enviado el: MiƩrcoles, 07 de Enero de 2009 03:14 p.m.
Para: Log4J Developers List
Asunto: Re: Consult
On Jan 7, 2009, at 9:27 AM, Luciano Izquierdo wrote:
> Hi, i have a problem, and i want know if somebody can i help me.
>
>
>
> I have two appenders
>
>
> Appender1
>
> And
>
> Appender2
>
>
>
> And have one logger
>
> Logger1
>
>
> I want to do, that all messege debug, info, warn, error and fatal,
> will
> write in de appender 1.
>
> But also I want to do that only the ERROR message will write in the
> appender
> 2.
>
> How does to do this configuration in the properties file?
>
> Plese help me!
>
>
What you want to accomplish is:
Attach both appenders to the root logger, set the level for the root
to debug and set the threshold of appender2 to ERROR.
log4j.rootLogger=DEBUG,Appender1,Appender2
log4j.appender.Appender2.threshold=ERROR
....
The only difference from your description is that both ERROR and FATAL
messages will go to Appender2. If you really only wanted ERROR, you
could apply a filter to Appender2, but that is more complicated and
likely this solution is sufficient.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
RE: Consult
Posted by Luciano Izquierdo <li...@moviltek.com>.
Hi, thanks for your answer.
But your solution is if I will have only two appenders.
That does not serve me because I have more than two appenders, then if I
change the root logger, the others appenders and loggers can be broken.
I need a solution without changing de rootLogger.
My application have many loggers and appenders.
How can I do?
-----Mensaje original-----
De: Curt Arnold [mailto:carnold@apache.org]
Enviado el: MiƩrcoles, 07 de Enero de 2009 03:14 p.m.
Para: Log4J Developers List
Asunto: Re: Consult
On Jan 7, 2009, at 9:27 AM, Luciano Izquierdo wrote:
> Hi, i have a problem, and i want know if somebody can i help me.
>
>
>
> I have two appenders
>
>
> Appender1
>
> And
>
> Appender2
>
>
>
> And have one logger
>
> Logger1
>
>
> I want to do, that all messege debug, info, warn, error and fatal,
> will
> write in de appender 1.
>
> But also I want to do that only the ERROR message will write in the
> appender
> 2.
>
> How does to do this configuration in the properties file?
>
> Plese help me!
>
>
What you want to accomplish is:
Attach both appenders to the root logger, set the level for the root
to debug and set the threshold of appender2 to ERROR.
log4j.rootLogger=DEBUG,Appender1,Appender2
log4j.appender.Appender2.threshold=ERROR
....
The only difference from your description is that both ERROR and FATAL
messages will go to Appender2. If you really only wanted ERROR, you
could apply a filter to Appender2, but that is more complicated and
likely this solution is sufficient.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Re: Consult
Posted by Curt Arnold <ca...@apache.org>.
On Jan 7, 2009, at 9:27 AM, Luciano Izquierdo wrote:
> Hi, i have a problem, and i want know if somebody can i help me.
>
>
>
> I have two appenders
>
>
> Appender1
>
> And
>
> Appender2
>
>
>
> And have one logger
>
> Logger1
>
>
> I want to do, that all messege debug, info, warn, error and fatal,
> will
> write in de appender 1.
>
> But also I want to do that only the ERROR message will write in the
> appender
> 2.
>
> How does to do this configuration in the properties file?
>
> Plese help me!
>
>
What you want to accomplish is:
Attach both appenders to the root logger, set the level for the root
to debug and set the threshold of appender2 to ERROR.
log4j.rootLogger=DEBUG,Appender1,Appender2
log4j.appender.Appender2.threshold=ERROR
....
The only difference from your description is that both ERROR and FATAL
messages will go to Appender2. If you really only wanted ERROR, you
could apply a filter to Appender2, but that is more complicated and
likely this solution is sufficient.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org
Consult
Posted by Luciano Izquierdo <li...@moviltek.com>.
Hi, i have a problem, and i want know if somebody can i help me.
I have two appenders
Appender1
And
Appender2
And have one logger
Logger1
I want to do, that all messege debug, info, warn, error and fatal, will
write in de appender 1.
But also I want to do that only the ERROR message will write in the appender
2.
How does to do this configuration in the properties file?
Plese help me!
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-dev-help@logging.apache.org