Log4j 2 includes some JUL support. Is that what you are trying to do?

Gary

On Thu, Apr 16, 2015 at 11:43 PM, Chathura Priyankara <
priyankara...@gmail.com> wrote:

> Hi
>
> I'm in the process of upgrading log4j 1.2 custom console appender to
> Log4j 2. Here the LoggingEvent is used to get the log event from the
> java.util.logging.LogRecord and then to doAppend that log event. Eg:
> LoggingEvent loggingEvent = LoggingUtils.getLogEvent(record);
> doAppend(loggingEvent);
>
> Is there anyway that I can create a custom console appender ?
> I cannot find a sample for this.
>
> Any help is appreciated.
>
> Thanks!
> Chathura.
>
> On Fri, Apr 10, 2015 at 9:02 PM, Ralph Goers <ralph.go...@dslextreme.com>
> wrote:
>
>> This really doesn’t tell me what you are trying to do. Where did you get
>> the LogRecord from and why do you need the LoggingEvent?
>>
>> The class that corresponds to a LoggingEvent is the LogEvent interface
>> which is backed by the Log4jLogEvent class. As I said, these are internal
>> to Log4j 2 and really shouldn’t be used directly, so it would be really
>> helpful to know what you are trying to do so we can offer advice on how to
>> do it.
>>
>> Ralph
>>
>> On Apr 9, 2015, at 9:31 PM, Chathura Priyankara <priyankara...@gmail.com>
>> wrote:
>>
>> Hi Ralph.
>>
>> Thank you very much for the response.
>>
>> I want to return a logging event from the given log record. So in the
>> application that I'm trying to upgrade there is an implementation to get
>> log event like follows :
>>
>> public static LoggingEvent getLogEvent(LogRecord record) {
>>     Priority level = getLogLevel(record.getLevel());
>>
>>     return new LoggingEvent(record.getSourceClassName(),
>>             Logger.getLogger(record.getSourceClassName()), level,
>>             record.getMessage(), record.getThrown());
>> }
>>
>> So is there anyway that I can make this work ?
>>
>> Regards,
>> Chathura.
>>
>>
>>
>> On Fri, Apr 10, 2015 at 9:51 AM, Ralph Goers <ralph.go...@dslextreme.com>
>> wrote:
>>
>>> The equivalent of the LoggingEvent is an internal part of the Log4j 2
>>> core. Can you explain what you are trying to do?
>>>
>>> Ralph
>>>
>>> On Apr 9, 2015, at 8:59 PM, Chathura Priyankara <priyankara...@gmail.com>
>>> wrote:
>>>
>>> Hi,
>>>
>>> I'm trying to upgrade Log4j 1.2.17 to Log4j 2.2. First I tried to do
>>> this using Log4j 1.x bridge as mentioned in [1], but I couldn't find a way
>>> to use LoggingEvent with log4j 2.2.
>>> In Log4j 2.x LoggingEvent is removed or I'm missing something ?
>>> Is there something similar to LoggingEvent in the new version ?
>>>
>>> [1] https://logging.apache.org/log4j/2.x/manual/migration.html
>>>
>>> Thanks,
>>> Best Regards,
>>> Chathura.
>>>
>>> --
>>> Chathura Priyankara,
>>> Faculty of Information Technology,
>>> University of Moratuwa.
>>> Blog  : www.codeoncloud.blogspot.com
>>>
>>>
>>
>>
>> --
>> Chathura Priyankara,
>> Faculty of Information Technology,
>> University of Moratuwa.
>> Blog  : www.codeoncloud.blogspot.com
>>
>>
>>
>
>
> --
> Chathura Priyankara,
> Faculty of Information Technology,
> University of Moratuwa.
> Blog  : www.codeoncloud.blogspot.com
>



-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
Java Persistence with Hibernate, Second Edition
<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to