Again, if you use an async logger you will lose whatever is in the memory 
buffer when the server stops or crashes. If you log directly to Flume you are 
guaranteed that the audit event is written when the logging call returns and 
your application can count on that.

The only thing you really need to be aware of is that in an HA configuration it 
is possible to end up with multiple instances of the event in the final 
repository so you need to make sure your events include a unique key that can 
be used to remove duplicates.

Ralph

> On Apr 3, 2017, at 8:40 PM, Gary Gregory <garydgreg...@gmail.com> wrote:
> 
> Thanks Matt. With the Flume appender, do I still need to use an async logger 
> to get the best perf?
> 
> Gary
> 
> On Mon, Apr 3, 2017 at 8:31 PM, Matt Sicker <boa...@gmail.com 
> <mailto:boa...@gmail.com>> wrote:
> Clarifications: other than the file appenders, the flume appender is probably 
> the most reliable appender.
> 
> And for the direct appender config, that's also with fully async loggers. 
> I've been considering putting together a small blog post about the most 
> efficient log4j2.xml configurations.
> 
> On 3 April 2017 at 22:01, Matt Sicker <boa...@gmail.com 
> <mailto:boa...@gmail.com>> wrote:
> The Flume appender can persist messages within the same process to files 
> before sending them to other agents. I don't think any other appender can 
> guarantee that.
> 
> Personally, I've been using direct console appenders lately and using graylog 
> to slurp stdout on docker containers, but I'm not the one who set all that 
> up. Either way, the most reliable way to log things outside of files is Flume.
> 
> On 3 April 2017 at 19:45, Gary Gregory <garydgreg...@gmail.com 
> <mailto:garydgreg...@gmail.com>> wrote:
> Wait a sec. A JMS provider can guarantee message delivery. How can events be 
> lost once they are in the provider? Are you saying that using an async logger 
> is 'unsafe' because the events in the ring buffer go away if the JVM goes 
> down?
> 
> Ideally I want to publish and forget, with the publish part asynchronous, 
> call the API, and it returns right away.
> 
> Is there no way to do that with our JMS Appender?
> 
> Gary
> 
> On Mon, Apr 3, 2017 at 5:38 PM, Ralph Goers <ralph.go...@dslextreme.com 
> <mailto:ralph.go...@dslextreme.com>> wrote:
> What’s the point though when all you have to do is specify the pattern layout 
> with “%m%ex{none}”?
> 
> How can you do auditing with the async logger? You may lose events with that.
> 
> Your use case is exactly why I wrote the FlumeAppender. It is very much like 
> JMS but a whole lot faster and guarantees events aren’t lost.
> 
> Ralph
> 
>> On Apr 3, 2017, at 5:03 PM, Gary Gregory <garydgreg...@gmail.com 
>> <mailto:garydgreg...@gmail.com>> wrote:
>> 
>> Right. I want to post to JMS message objects I've serialized to JSON. All I 
>> care about is the message.
>> 
>> I log these events to a specially named logger with a specially named 
>> marker. These are the only events that should be published to JMS (I use a 
>> filter and the one marker). I am in charge of the message format and it is 
>> consumed on the other JMS side by a specialized agent which I also control.
>> 
>> IOW, I am using the Log4j infrastructure as the simplest way to send custom 
>> messages over to JMS. These are not traditional logging events, rather a 
>> kind of auditing system. I leverage the Log4j async logger as well. No need 
>> to deal with the JMS API.
>> 
>> Gary
>> 
>> On Mon, Apr 3, 2017 at 4:07 PM, Remko Popma <remko.po...@gmail.com 
>> <mailto:remko.po...@gmail.com>> wrote:
>> So, exceptions are swallowed and no newlines are rendered? Interesting. 
>> What's the use case?
>> 
>> Sent from my iPhone
>> 
>> On Apr 4, 2017, at 7:30, Gary Gregory <garydgreg...@gmail.com 
>> <mailto:garydgreg...@gmail.com>> wrote:
>> 
>>> Hi All,
>>> 
>>> I am considering a new layout called "MessageLayout" which would be 
>>> synonymous with:<PatternLayout pattern="%m" />. Thoughts? 
>>> 
>>> Gary
>>> 
>>> -- 
>>> E-Mail: garydgreg...@gmail.com <mailto:garydgreg...@gmail.com> | 
>>> ggreg...@apache.org  <mailto:ggreg...@apache.org>
>>> Java Persistence with Hibernate, Second Edition 
>>> <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
>>>   
>>> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
>>> JUnit in Action, Second Edition 
>>> <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>
>>>   
>>> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
>>> Spring Batch in Action 
>>> <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
>>>   
>>> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
>>> Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/> 
>>> Home: http://garygregory.com/ <http://garygregory.com/>
>>> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
>> 
>> 
>> -- 
>> E-Mail: garydgreg...@gmail.com <mailto:garydgreg...@gmail.com> | 
>> ggreg...@apache.org  <mailto:ggreg...@apache.org>
>> Java Persistence with Hibernate, Second Edition 
>> <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
>>   
>> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
>> JUnit in Action, Second Edition 
>> <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>
>>   
>> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
>> Spring Batch in Action 
>> <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
>>   
>> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
>> Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/> 
>> Home: http://garygregory.com/ <http://garygregory.com/>
>> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
> 
> 
> 
> -- 
> E-Mail: garydgreg...@gmail.com <mailto:garydgreg...@gmail.com> | 
> ggreg...@apache.org  <mailto:ggreg...@apache.org>
> Java Persistence with Hibernate, Second Edition 
> <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
>   
> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
> JUnit in Action, Second Edition 
> <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>
>   
> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
> Spring Batch in Action 
> <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
>   
> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
> Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/> 
> Home: http://garygregory.com/ <http://garygregory.com/>
> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>
> 
> 
> -- 
> Matt Sicker <boa...@gmail.com <mailto:boa...@gmail.com>>
> 
> 
> 
> -- 
> Matt Sicker <boa...@gmail.com <mailto:boa...@gmail.com>>
> 
> 
> 
> -- 
> E-Mail: garydgreg...@gmail.com <mailto:garydgreg...@gmail.com> | 
> ggreg...@apache.org  <mailto:ggreg...@apache.org>
> Java Persistence with Hibernate, Second Edition 
> <https://www.amazon.com/gp/product/1617290459/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1617290459&linkCode=as2&tag=garygregory-20&linkId=cadb800f39946ec62ea2b1af9fe6a2b8>
>   
> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1617290459>
> JUnit in Action, Second Edition 
> <https://www.amazon.com/gp/product/1935182021/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182021&linkCode=as2&tag=garygregory-20&linkId=31ecd1f6b6d1eaf8886ac902a24de418%22>
>   
> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182021>
> Spring Batch in Action 
> <https://www.amazon.com/gp/product/1935182951/ref=as_li_tl?ie=UTF8&camp=1789&creative=9325&creativeASIN=1935182951&linkCode=%7B%7BlinkCode%7D%7D&tag=garygregory-20&linkId=%7B%7Blink_id%7D%7D%22%3ESpring+Batch+in+Action>
>   
> <http://ir-na.amazon-adsystem.com/e/ir?t=garygregory-20&l=am2&o=1&a=1935182951>
> Blog: http://garygregory.wordpress.com <http://garygregory.wordpress.com/> 
> Home: http://garygregory.com/ <http://garygregory.com/>
> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>

Reply via email to