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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to