Hello Oliver,
The formatter need not implement the LogEventBroadcaster interface, it is optional.
The initial messages are logged with the default formatter before the LoggingService has a chance to read the config and apply the properties, so there is not much we can do about it.
Sandeep
-----Original Message-----
From: Oliver B. Fischer [mailto:mailsink_at_swe-blog.net]
Sent: Monday, November 11, 2013 1:22 AM
To: users_at_glassfish.java.net
Subject: Re: Logging in JSON
Hello Alexander,
I am using java.util.logging. Two things confusing. The first issue is that the formatter does much more then only formatting. It implements alos LogEventBroadcaster. So it does more then only formatting. If would like to implement my own formatter I should implement this interface to.
That is the secound issue that bothers me. Also a custom log formatter is never used for the initial log message.
Because of a this issues I decided to solve this problem by writing a simple converter. It takes all finished log files, converts them into JSON messages and forwards it to ElasticSearch.
Bye,
Oliver
Am 07.11.13 20:17, schrieb Alexander Schell:
> Hello Oliver
>
> It's a few years ago and I cannot remember quite exactly...
> What kind of logging framework are you using? I used Log4J back then.
>
> If I remember right, I didn't wrote a formatter; forget what I said
> before... :)
>
> I tried it, but then I put all the logic in a custom appender. This
> appender created the json represantations as also sent them over a
> message queue to mdbean on a glassfish application server...
>
> I hope that I'll find the time to reimplement it. It was a nice -
> Well, at least in my opinion - solution to log into a database, which
> enabled me to use all the nice sql-stuff to seachr for entries.
>
>
> Best regards
>
> Alex
>
>
> Am 06.11.2013 23:07, schrieb Oliver B. Fischer:
>> Hello Alexander,
>>
>> I implemented a very simple formatter today. But the first message is
>> still handled by the default formatter. I think it is because the
>> setup of the formatter is done in the postConstruct() method of the
>> GFFileHandler.
>>
>> Did you replace the default GFFileHandler or added additional handlers?
>>
>> Bye,
>>
>> Oliver
>>
>> Am 06.11.13 20:40, schrieb Alexander Schell:
>>> Hello
>>>
>>> I did so, but unfortunately I do not own the code. And an
>>> MQ-Appender also, so you can send your log entries to an application
>>> server to store them in a database...
>>>
>>> It's not this difficult, really.
>>>
>>> Maybe I have a solution for you in a couple of days. I was thinking
>>> about re-implementing this stuff... :)
>>>
>>>
>>> Have a nice evening
>>>
>>> Alex
>>>
>>>
>>> Am 06.11.2013 12:26, schrieb Oliver B. Fischer:
>>>> Hi,
>>>>
>>>> has anyone of you written a log formatter for JSON? I would like to
>>>> write the log records as JSON document.
>>>>
>>>> It would be nice not to do the same work twice ;-)
>>>>
>>>> Bye,
>>>>
>>>> Oliver
>>>>
>>>
>>
>