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 bakermatt <ba...@gmail.com> on 2008/02/19 23:39:22 UTC

How do receivers work?

Hi,

I've spent the last couple weeks attempting to work the the Apache Receivers
but to no avail.  Could someone explain to me exactly how you get the
LoggingEvents out of a receiver once they arrive?

Thanks,
Matt
-- 
View this message in context: http://www.nabble.com/How-do-receivers-work--tp15576255p15576255.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Re: How do receivers work?

Posted by bakermatt <ba...@gmail.com>.
Ok, turns out the reason I wasn't seeing any is because I had
filterExpression set to "filter" for some stupid reason...obviously that
won't work.

So now I think I've got it.  I have a DataCollector class with a Receiver
instance (the receiver it's interested in receiving messages from), and a
list of datasamples (the object I transform each LoggingEvent into).  When
DataCollector is Initialized it:

1) configures the Receiver by setting the LoggerRepository to a new instance
of Hierarchy with the root logger set as a Logger instance created from
Logger.getLogger(receiver.getName() + "Logger") (under the assumption that
the receiver names are unique, otherwise they will interfere with each
other).  
2) silence the "org.apache.log4j" logger by setting its level to Level.OFF
to eliminate the Receiver's tracing messages.

Putting each receiver in its own Hierarchy effectively isolates it from the
other DataCollectors and allows the each DataCollector to only get messages
from its own respective Receiver.

Sound about right?

Matt

Paul Smith-2 wrote:
> 
> 
> On 21/02/2008, at 8:07 AM, bakermatt wrote:
> 
>>
>> What Logger does a receiver post its LoggingEvents to?  I can't find  
>> it
>> anywhere in the LoggerRepository and it's driving me crazy.  I'm  
>> getting all
>> the messages from the Receiver itself, but none of the messages that  
>> the
>> Receiver is bringing in.  I need to know what Logger to attach my  
>> Appender
>> to.
>>
> 
> The event appears against the same logger that the original event was  
> generated from.
> 
> My advice is to attach a simple ConsoleAppender to the root of the  
> logger hierarchy and post a sample of the results you see, and flag  
> which class of event you're interested in trapping in your custom  
> appender.  Please also attach your log4j configuration file that is  
> configuring the Receiver and custom appender so we can help you.
> 
> cheers,
> 
> Paul
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-do-receivers-work--tp15576255p15601036.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Re: How do receivers work?

Posted by Paul Smith <ps...@aconex.com>.
On 21/02/2008, at 8:07 AM, bakermatt wrote:

>
> What Logger does a receiver post its LoggingEvents to?  I can't find  
> it
> anywhere in the LoggerRepository and it's driving me crazy.  I'm  
> getting all
> the messages from the Receiver itself, but none of the messages that  
> the
> Receiver is bringing in.  I need to know what Logger to attach my  
> Appender
> to.
>

The event appears against the same logger that the original event was  
generated from.

My advice is to attach a simple ConsoleAppender to the root of the  
logger hierarchy and post a sample of the results you see, and flag  
which class of event you're interested in trapping in your custom  
appender.  Please also attach your log4j configuration file that is  
configuring the Receiver and custom appender so we can help you.

cheers,

Paul

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


Re: How do receivers work?

Posted by bakermatt <ba...@gmail.com>.
What Logger does a receiver post its LoggingEvents to?  I can't find it
anywhere in the LoggerRepository and it's driving me crazy.  I'm getting all
the messages from the Receiver itself, but none of the messages that the
Receiver is bringing in.  I need to know what Logger to attach my Appender
to.

Thanks,
Matt


Paul Smith-2 wrote:
> 
> 
> On 20/02/2008, at 11:32 AM, bakermatt wrote:
> 
>>
>> Ok,
>>
>> So I got it so that the LoggingEvents get dispatched to my Appender  
>> but ALL
>> of the Events get posted there, even the INFO and DEBUG events  
>> coming from
>> the Receiver itself.  How can I isolate the incoming messages from the
>> messages being generated internally?  Also, I am setting the
>> LoggerRepository on the receivers to LogManager.getLoggerRepository().
>> Should I create a new Hierarchy instance to isolate the Receivers  
>> from each
>> other, or should I keep it the way it is?
>>
>>
> 
> Just turn down the verbosity of the 'org.apache.log4j' top-level  
> logger as you would any other logger in your log4j configuration, that  
> way your custom appender never receives these events.
> 
> Alternatively if the logging events you're really interested in come  
> from your own company code, say 'com.mycompany', you could attach your  
> custom appender that is processing these events to the logical top  
> level logger of interest, thereby bypassing any org.apache.log4j ones.
> 
> cheers,
> 
> Paul
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-do-receivers-work--tp15576255p15598180.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


RE: How do receivers work?

Posted by Scott Deboy <sd...@comotivsystems.com>.
Probably 

dd MMM yyyy HH:mm:ss,SSS



Scott Deboy
Principal Engineer
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR  97201
Office: 503.224.7496
Direct Line: 503.821.6482
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com

-----Original Message-----
From: bakermatt [mailto:baker.matt.l@gmail.com] 
Sent: Wednesday, February 20, 2008 8:56 AM
To: log4j-user@logging.apache.org
Subject: RE: How do receivers work?


What format should I use?

I already tried "dd MM yyyy HH:mm:ss,SSS" but it didn't work.  What
should I
use to denote an actual month abbreviation as opposed to a numerical
representation?  My conversionFormat for the timestamp in the Appender
is
'%d{DATE}', not just %d.  Any suggestions?

Thanks,
Matt


sdeboy wrote:
> 
> Correct the timestamp format in the receiver config..that's probably
the
> only issue.
> 
> Scott Deboy
> Principal Engineer
> COMOTIV SYSTEMS
> 111 SW Columbia Street Ste. 950
> Portland, OR  97201
> Office: 503.224.7496
> Direct Line: 503.821.6482
> Cell: 503.997.1367
> Fax: 503.222.0185
> sdeboy@comotivsystems.com
> www.comotivsystems.com
> 
> 
> -----Original Message-----
> From: bakermatt [mailto:baker.matt.l@gmail.com] 
> Sent: Tuesday, February 19, 2008 5:36 PM
> To: log4j-user@logging.apache.org
> Subject: Re: How do receivers work?
> 
> 
> This is an extremely noob question but how do I setup my logFormat if
my
> message looks like this:
> 
> 19 Feb 2008 14:10:32,001 INFO  DataCollectorTestAppender [main][]:
> LogMonitor - CanCaptureLogEvent
> 
> Where:
> 
> 19 Feb 2008 14:10:32,001 = TIMESTAMP
> INFO  = LEVEL
> DataCollectorTestAppender = LOGGER
> [main] = THREAD
> [] = [*]
> LogMonitor - CanCaptureLogEvent = MESSAGE
> 
> it is just "TIMESTAMP LEVEL LOGGER [THREAD][*]: MESSAGE" right?  The
> receiver keeps giving me the "found non-matching line:" error.
Perhaps
> my
> timeStampFormat is incorrect as yyyy-MM-d HH:mm:ss,SSS?
> 
> Thanks,
> Matt
> 
> Paul Smith-2 wrote:
>> 
>> 
>> On 20/02/2008, at 11:32 AM, bakermatt wrote:
>> 
>>>
>>> Ok,
>>>
>>> So I got it so that the LoggingEvents get dispatched to my Appender

>>> but ALL
>>> of the Events get posted there, even the INFO and DEBUG events  
>>> coming from
>>> the Receiver itself.  How can I isolate the incoming messages from
> the
>>> messages being generated internally?  Also, I am setting the
>>> LoggerRepository on the receivers to
> LogManager.getLoggerRepository().
>>> Should I create a new Hierarchy instance to isolate the Receivers  
>>> from each
>>> other, or should I keep it the way it is?
>>>
>>>
>> 
>> Just turn down the verbosity of the 'org.apache.log4j' top-level  
>> logger as you would any other logger in your log4j configuration,
that
> 
>> way your custom appender never receives these events.
>> 
>> Alternatively if the logging events you're really interested in come

>> from your own company code, say 'com.mycompany', you could attach
your
> 
>> custom appender that is processing these events to the logical top  
>> level logger of interest, thereby bypassing any org.apache.log4j
ones.
>> 
>> cheers,
>> 
>> Paul
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/How-do-receivers-work--tp15576255p15580474.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/How-do-receivers-work--tp15576255p15592364.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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


Re: How do receivers work?

Posted by Curt Arnold <ca...@apache.org>.
On Feb 20, 2008, at 10:55 AM, bakermatt wrote:

>
> What format should I use?
>
> I already tried "dd MM yyyy HH:mm:ss,SSS" but it didn't work.  What  
> should I
> use to denote an actual month abbreviation as opposed to a numerical
> representation?  My conversionFormat for the timestamp in the  
> Appender is
> '%d{DATE}', not just %d.  Any suggestions?
>
> Thanks,
> Matt


DATE is equivalent to "dd MMM yyyy HH:mm:ss,SSS".


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


RE: How do receivers work?

Posted by bakermatt <ba...@gmail.com>.
What format should I use?

I already tried "dd MM yyyy HH:mm:ss,SSS" but it didn't work.  What should I
use to denote an actual month abbreviation as opposed to a numerical
representation?  My conversionFormat for the timestamp in the Appender is
'%d{DATE}', not just %d.  Any suggestions?

Thanks,
Matt


sdeboy wrote:
> 
> Correct the timestamp format in the receiver config..that's probably the
> only issue.
> 
> Scott Deboy
> Principal Engineer
> COMOTIV SYSTEMS
> 111 SW Columbia Street Ste. 950
> Portland, OR  97201
> Office: 503.224.7496
> Direct Line: 503.821.6482
> Cell: 503.997.1367
> Fax: 503.222.0185
> sdeboy@comotivsystems.com
> www.comotivsystems.com
> 
> 
> -----Original Message-----
> From: bakermatt [mailto:baker.matt.l@gmail.com] 
> Sent: Tuesday, February 19, 2008 5:36 PM
> To: log4j-user@logging.apache.org
> Subject: Re: How do receivers work?
> 
> 
> This is an extremely noob question but how do I setup my logFormat if my
> message looks like this:
> 
> 19 Feb 2008 14:10:32,001 INFO  DataCollectorTestAppender [main][]:
> LogMonitor - CanCaptureLogEvent
> 
> Where:
> 
> 19 Feb 2008 14:10:32,001 = TIMESTAMP
> INFO  = LEVEL
> DataCollectorTestAppender = LOGGER
> [main] = THREAD
> [] = [*]
> LogMonitor - CanCaptureLogEvent = MESSAGE
> 
> it is just "TIMESTAMP LEVEL LOGGER [THREAD][*]: MESSAGE" right?  The
> receiver keeps giving me the "found non-matching line:" error.  Perhaps
> my
> timeStampFormat is incorrect as yyyy-MM-d HH:mm:ss,SSS?
> 
> Thanks,
> Matt
> 
> Paul Smith-2 wrote:
>> 
>> 
>> On 20/02/2008, at 11:32 AM, bakermatt wrote:
>> 
>>>
>>> Ok,
>>>
>>> So I got it so that the LoggingEvents get dispatched to my Appender  
>>> but ALL
>>> of the Events get posted there, even the INFO and DEBUG events  
>>> coming from
>>> the Receiver itself.  How can I isolate the incoming messages from
> the
>>> messages being generated internally?  Also, I am setting the
>>> LoggerRepository on the receivers to
> LogManager.getLoggerRepository().
>>> Should I create a new Hierarchy instance to isolate the Receivers  
>>> from each
>>> other, or should I keep it the way it is?
>>>
>>>
>> 
>> Just turn down the verbosity of the 'org.apache.log4j' top-level  
>> logger as you would any other logger in your log4j configuration, that
> 
>> way your custom appender never receives these events.
>> 
>> Alternatively if the logging events you're really interested in come  
>> from your own company code, say 'com.mycompany', you could attach your
> 
>> custom appender that is processing these events to the logical top  
>> level logger of interest, thereby bypassing any org.apache.log4j ones.
>> 
>> cheers,
>> 
>> Paul
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
>> 
> 
> -- 
> View this message in context:
> http://www.nabble.com/How-do-receivers-work--tp15576255p15580474.html
> Sent from the Log4j - Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-do-receivers-work--tp15576255p15592364.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


RE: How do receivers work?

Posted by Scott Deboy <sd...@comotivsystems.com>.
Correct the timestamp format in the receiver config..that's probably the
only issue.

Scott Deboy
Principal Engineer
COMOTIV SYSTEMS
111 SW Columbia Street Ste. 950
Portland, OR  97201
Office: 503.224.7496
Direct Line: 503.821.6482
Cell: 503.997.1367
Fax: 503.222.0185
sdeboy@comotivsystems.com
www.comotivsystems.com


-----Original Message-----
From: bakermatt [mailto:baker.matt.l@gmail.com] 
Sent: Tuesday, February 19, 2008 5:36 PM
To: log4j-user@logging.apache.org
Subject: Re: How do receivers work?


This is an extremely noob question but how do I setup my logFormat if my
message looks like this:

19 Feb 2008 14:10:32,001 INFO  DataCollectorTestAppender [main][]:
LogMonitor - CanCaptureLogEvent

Where:

19 Feb 2008 14:10:32,001 = TIMESTAMP
INFO  = LEVEL
DataCollectorTestAppender = LOGGER
[main] = THREAD
[] = [*]
LogMonitor - CanCaptureLogEvent = MESSAGE

it is just "TIMESTAMP LEVEL LOGGER [THREAD][*]: MESSAGE" right?  The
receiver keeps giving me the "found non-matching line:" error.  Perhaps
my
timeStampFormat is incorrect as yyyy-MM-d HH:mm:ss,SSS?

Thanks,
Matt

Paul Smith-2 wrote:
> 
> 
> On 20/02/2008, at 11:32 AM, bakermatt wrote:
> 
>>
>> Ok,
>>
>> So I got it so that the LoggingEvents get dispatched to my Appender  
>> but ALL
>> of the Events get posted there, even the INFO and DEBUG events  
>> coming from
>> the Receiver itself.  How can I isolate the incoming messages from
the
>> messages being generated internally?  Also, I am setting the
>> LoggerRepository on the receivers to
LogManager.getLoggerRepository().
>> Should I create a new Hierarchy instance to isolate the Receivers  
>> from each
>> other, or should I keep it the way it is?
>>
>>
> 
> Just turn down the verbosity of the 'org.apache.log4j' top-level  
> logger as you would any other logger in your log4j configuration, that

> way your custom appender never receives these events.
> 
> Alternatively if the logging events you're really interested in come  
> from your own company code, say 'com.mycompany', you could attach your

> custom appender that is processing these events to the logical top  
> level logger of interest, thereby bypassing any org.apache.log4j ones.
> 
> cheers,
> 
> Paul
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context:
http://www.nabble.com/How-do-receivers-work--tp15576255p15580474.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


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


Re: How do receivers work?

Posted by bakermatt <ba...@gmail.com>.
This is an extremely noob question but how do I setup my logFormat if my
message looks like this:

19 Feb 2008 14:10:32,001 INFO  DataCollectorTestAppender [main][]:
LogMonitor - CanCaptureLogEvent

Where:

19 Feb 2008 14:10:32,001 = TIMESTAMP
INFO  = LEVEL
DataCollectorTestAppender = LOGGER
[main] = THREAD
[] = [*]
LogMonitor - CanCaptureLogEvent = MESSAGE

it is just "TIMESTAMP LEVEL LOGGER [THREAD][*]: MESSAGE" right?  The
receiver keeps giving me the "found non-matching line:" error.  Perhaps my
timeStampFormat is incorrect as yyyy-MM-d HH:mm:ss,SSS?

Thanks,
Matt

Paul Smith-2 wrote:
> 
> 
> On 20/02/2008, at 11:32 AM, bakermatt wrote:
> 
>>
>> Ok,
>>
>> So I got it so that the LoggingEvents get dispatched to my Appender  
>> but ALL
>> of the Events get posted there, even the INFO and DEBUG events  
>> coming from
>> the Receiver itself.  How can I isolate the incoming messages from the
>> messages being generated internally?  Also, I am setting the
>> LoggerRepository on the receivers to LogManager.getLoggerRepository().
>> Should I create a new Hierarchy instance to isolate the Receivers  
>> from each
>> other, or should I keep it the way it is?
>>
>>
> 
> Just turn down the verbosity of the 'org.apache.log4j' top-level  
> logger as you would any other logger in your log4j configuration, that  
> way your custom appender never receives these events.
> 
> Alternatively if the logging events you're really interested in come  
> from your own company code, say 'com.mycompany', you could attach your  
> custom appender that is processing these events to the logical top  
> level logger of interest, thereby bypassing any org.apache.log4j ones.
> 
> cheers,
> 
> Paul
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-do-receivers-work--tp15576255p15580474.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Re: How do receivers work?

Posted by Paul Smith <ps...@aconex.com>.
On 20/02/2008, at 11:32 AM, bakermatt wrote:

>
> Ok,
>
> So I got it so that the LoggingEvents get dispatched to my Appender  
> but ALL
> of the Events get posted there, even the INFO and DEBUG events  
> coming from
> the Receiver itself.  How can I isolate the incoming messages from the
> messages being generated internally?  Also, I am setting the
> LoggerRepository on the receivers to LogManager.getLoggerRepository().
> Should I create a new Hierarchy instance to isolate the Receivers  
> from each
> other, or should I keep it the way it is?
>
>

Just turn down the verbosity of the 'org.apache.log4j' top-level  
logger as you would any other logger in your log4j configuration, that  
way your custom appender never receives these events.

Alternatively if the logging events you're really interested in come  
from your own company code, say 'com.mycompany', you could attach your  
custom appender that is processing these events to the logical top  
level logger of interest, thereby bypassing any org.apache.log4j ones.

cheers,

Paul



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


Re: How do receivers work?

Posted by bakermatt <ba...@gmail.com>.
Ok,

So I got it so that the LoggingEvents get dispatched to my Appender but ALL
of the Events get posted there, even the INFO and DEBUG events coming from
the Receiver itself.  How can I isolate the incoming messages from the
messages being generated internally?  Also, I am setting the
LoggerRepository on the receivers to LogManager.getLoggerRepository(). 
Should I create a new Hierarchy instance to isolate the Receivers from each
other, or should I keep it the way it is?

Thanks,
Matt


Paul Smith-2 wrote:
> 
>>
>> I've spent the last couple weeks attempting to work the the Apache  
>> Receivers
>> but to no avail.  Could someone explain to me exactly how you get the
>> LoggingEvents out of a receiver once they arrive?
> 
> A Receiver 'posts' the received LoggingEvent into the local log4j  
> system just as if the thing that generated the event existed in that  
> process.
> 
> To that end, once the LoggingEvent is in the local log4j 'bus', you  
> need to configure an Appender to deal with it.  A log4j environment  
> with one or more Receivers and no Appenders is effectively  
> broadcasting into silence.  As close to 'cat * > /dev/null' as you can  
> get.
> 
> What exactly do you want to do with the events once you've received  
> them?
> 
> cheers,
> 
> Paul
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-do-receivers-work--tp15576255p15579665.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Re: How do receivers work?

Posted by bakermatt <ba...@gmail.com>.
Paul,

I thought this was how it worked but was getting extremely confused when
trying to mimic what was going on inside Chainsaw with the interaction
between ChainsawAppender and ChainsawAppenderHandler.

I have a DataCollector class with an instance of a Receiver (the receiver
it's interested in) and a list of data samples.  When I get the
LoggingEvents (I think from an EventBatch like in Chainsaw) I need to
transform them into my Data Samples and store them in that list.

Thanks,
Matt


Paul Smith-2 wrote:
> 
>>
>> I've spent the last couple weeks attempting to work the the Apache  
>> Receivers
>> but to no avail.  Could someone explain to me exactly how you get the
>> LoggingEvents out of a receiver once they arrive?
> 
> A Receiver 'posts' the received LoggingEvent into the local log4j  
> system just as if the thing that generated the event existed in that  
> process.
> 
> To that end, once the LoggingEvent is in the local log4j 'bus', you  
> need to configure an Appender to deal with it.  A log4j environment  
> with one or more Receivers and no Appenders is effectively  
> broadcasting into silence.  As close to 'cat * > /dev/null' as you can  
> get.
> 
> What exactly do you want to do with the events once you've received  
> them?
> 
> cheers,
> 
> Paul
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-do-receivers-work--tp15576255p15578362.html
Sent from the Log4j - Users mailing list archive at Nabble.com.


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


Re: How do receivers work?

Posted by Paul Smith <ps...@aconex.com>.
>
> I've spent the last couple weeks attempting to work the the Apache  
> Receivers
> but to no avail.  Could someone explain to me exactly how you get the
> LoggingEvents out of a receiver once they arrive?

A Receiver 'posts' the received LoggingEvent into the local log4j  
system just as if the thing that generated the event existed in that  
process.

To that end, once the LoggingEvent is in the local log4j 'bus', you  
need to configure an Appender to deal with it.  A log4j environment  
with one or more Receivers and no Appenders is effectively  
broadcasting into silence.  As close to 'cat * > /dev/null' as you can  
get.

What exactly do you want to do with the events once you've received  
them?

cheers,

Paul

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