[logback-user] How to log FROM an appender?

ralph.goers @dslextreme.com rgoers at apache.org
Tue Nov 15 19:29:10 CET 2011


I realize this is off topic for this mailing list, but I would very much
appreciate you trying
https://svn.apache.org/repos/asf/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/
and
in particular
https://svn.apache.org/repos/asf/logging/log4j/branches/BRANCH_2_0_EXPERIMENTAL/rgoers/log4j2-core/src/main/java/org/apache/logging/log4j/core/appender/JMSQueueAppender.java
.

If you do give it a try please provide feedback on the log4j developers
list, not here.

Ralph

On Tue, Nov 15, 2011 at 10:12 AM, Steve Cohen <scohen at javactivity.org>wrote:

> Yes, as I indicated, it's a marginal use case.
> But
> 1) logging exceptions in the JMS transmission itself
> 2) Since the formatting of the message for the legacy logging system is
> happening in the JMS appender (arguably a suboptimal design) there is a use
> case for trace logging for development purposes to log the output of the
> formatting operation.  In production, this would certainly be turned off.
>
>
> On 11/15/2011 10:32 AM, TJ Rothwell wrote:
>
>> I must be missing something. Why the need to originate new logging
>> messages
>> from the appender? Any status updates you could do through ContextAware
>> methods; any custom work to the JMS Queue would occur in that appender. So
>> I don't understand the need for creating additional logging messages. If
>> the appender is acting as a filter so some messages can be processed by a
>> different appender, then a filter would help. [1]
>>
>> I'm glad you have something that works.
>>
>> [1] http://logback.qos.ch/manual/**filters.html<http://logback.qos.ch/manual/filters.html>
>>
>> -- TJ
>>
>> On Tue, Nov 15, 2011 at 7:39 AM, Steve Cohen<scohen at javactivity.org>
>>  wrote:
>>
>>  It's a JMSQueue-based appender.  It was written for log4j (only recently
>>> have we switched to logback) which didn't have one.  In addition to the
>>> JMS
>>> functionality, at the other end of the JMS socket sits a server
>>> application
>>> written in C with its own legacy logging system that must be catered to.
>>>  This involves some special formatting and data which is neither
>>> necessary
>>> nor desirable for inclusion in the local logging that the client-side
>>> application also needs.  The appender is perhaps the most convenient
>>> place
>>> to do this.
>>>
>>> However, I do suppose that I should look at the layout and custom format
>>> specifier supported by logback as a possibly better way to accomplish the
>>> same thing.  But what I have seems to work.
>>>
>>>
>>> On 11/14/2011 09:37 PM, TJ Rothwell wrote:
>>>
>>>  I'm curious: what use-case is fulfilled by the additional messages
>>>> generated by the appender?
>>>>
>>>> -- TJ
>>>>
>>>> On Mon, Nov 14, 2011 at 4:00 PM, Steve Cohen<scohen at javactivity.org>
>>>>  wrote:
>>>>
>>>>
>>>>  On 11/12/2011 04:14 PM, Steve Cohen wrote:
>>>>
>>>>>
>>>>>  We have a custom appender that may itself need to issue logging
>>>>>
>>>>>> statements. But placing a logger in such a class causes various
>>>>>> exceptions on initialization and loading. So we are resorting to
>>>>>> System.out.println for lack of a better solution.
>>>>>>
>>>>>> I suppose there must be a better way.
>>>>>> What would that be?
>>>>>>
>>>>>>
>>>>>> ______________________________******_________________
>>>>>> Logback-user mailing list
>>>>>> Logback-user at qos.ch
>>>>>> http://mailman.qos.ch/mailman/******listinfo/logback-user<http://mailman.qos.ch/mailman/****listinfo/logback-user>
>>>>>> <http**://mailman.qos.ch/mailman/****listinfo/logback-user<http://mailman.qos.ch/mailman/**listinfo/logback-user>
>>>>>> >
>>>>>> <http:/**/mailman.qos.ch/**mailman/**listinfo/logback-**user<http://mailman.qos.ch/mailman/**listinfo/logback-user>
>>>>>> <http://mailman.qos.ch/**mailman/listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
>>>>>> >
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>>  A technique that seems to work is to NOT declare a logger in the
>>>>>>
>>>>>>  Appender class that you want to use one from, but instead create a
>>>>> static
>>>>> logger instance somewhere that is accessible through static methods.
>>>>>  That
>>>>> way the logger does not need to be created at the time of appender
>>>>> instantiation.
>>>>>
>>>>> ______________________________******_________________
>>>>> Logback-user mailing list
>>>>> Logback-user at qos.ch
>>>>> http://mailman.qos.ch/mailman/******listinfo/logback-user<http://mailman.qos.ch/mailman/****listinfo/logback-user>
>>>>> <http**://mailman.qos.ch/mailman/****listinfo/logback-user<http://mailman.qos.ch/mailman/**listinfo/logback-user>
>>>>> >
>>>>> <http:/**/mailman.qos.ch/**mailman/**listinfo/logback-**user<http://mailman.qos.ch/mailman/**listinfo/logback-user>
>>>>> <http://mailman.qos.ch/**mailman/listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
>>>>> >
>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>
>>>> ______________________________****_________________
>>>> Logback-user mailing list
>>>> Logback-user at qos.ch
>>>> http://mailman.qos.ch/mailman/****listinfo/logback-user<http://mailman.qos.ch/mailman/**listinfo/logback-user>
>>>> <http:/**/mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
>>>> >
>>>>
>>>>
>>> ______________________________****_________________
>>> Logback-user mailing list
>>> Logback-user at qos.ch
>>> http://mailman.qos.ch/mailman/****listinfo/logback-user<http://mailman.qos.ch/mailman/**listinfo/logback-user>
>>> <http:/**/mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
>>> >
>>>
>>>
>>
>>
>> ______________________________**_________________
>> Logback-user mailing list
>> Logback-user at qos.ch
>> http://mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
>>
>
> ______________________________**_________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/**listinfo/logback-user<http://mailman.qos.ch/mailman/listinfo/logback-user>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20111115/03543662/attachment-0001.html>


More information about the Logback-user mailing list