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 Doug Glassman <dg...@uswest.com> on 2001/10/04 19:39:30 UTC
Custom appender question
I have a custom appender setup that routes messages to JMS . I am using
PatternLayout to format . How do I extract the format that exists in
the log4j.properties file for my specific custom appender ?
The getProperty will work but its not using the existing infrastructure.
public class JMSMsgAppender extends JMSAppender {
public static String
PATTERN_LAYOUT=System.getProperty("PATTERN_LAYOUT","%d (%F:%L) %5p [%t] %x -
%m%n");
public
void append(LoggingEvent event) {
try{
jmsConnection jmc = getjmsConnection();
PatternLayout aPatternLayout = new
PatternLayout(PATTERN_LAYOUT);
jmc.sendRequest(QUEUE,aPatternLayout.format(event));
}
catch (Exception ex){
System.err.println("Error sending alarm to JMS from JMSAppender:
........."+ex);
retryConnection(event);
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
features
Posted by Boris Garbuzov <bo...@xmlglobal.com>.
Please excuse my novice questions. I am trying to find out about the
product's features to propose its usage to my bosses.
1. Does log4j have any utilities for serving log files to a remote user or
anything related?
2. Can it produce well-formed XML file with a root tag, not just node list,
were it by cost of performance? If not, what is the recommended way of
rendering such semmi-XML file?
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org
Re: Custom appender question
Posted by Ceki Gülcü <cg...@qos.ch>.
The JMSAppender like the SocketAppender does not use a layout. The formatting is done at the
server side. Regards, Ceki
At 11:39 04.10.2001 -0600, you wrote:
>I have a custom appender setup that routes messages to JMS . I am using
>PatternLayout to format . How do I extract the format that exists in
>the log4j.properties file for my specific custom appender ?
>The getProperty will work but its not using the existing infrastructure.
>
>
>public class JMSMsgAppender extends JMSAppender {
>
> public static String
>PATTERN_LAYOUT=System.getProperty("PATTERN_LAYOUT","%d (%F:%L) %5p [%t] %x -
>%m%n");
>
> public
> void append(LoggingEvent event) {
>
> try{
> jmsConnection jmc = getjmsConnection();
>
> PatternLayout aPatternLayout = new
>PatternLayout(PATTERN_LAYOUT);
>
> jmc.sendRequest(QUEUE,aPatternLayout.format(event));
> }
> catch (Exception ex){
> System.err.println("Error sending alarm to JMS from JMSAppender:
>........."+ex);
> retryConnection(event);
> }
>
> }
>
>
>}
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: log4j-user-help@jakarta.apache.org
--
Ceki Gülcü - http://qos.ch
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: log4j-user-help@jakarta.apache.org