Yes, you could use the SocketAppender. You would just have to use the 
appropriate Layout with the SocketAppender.
There is no reason to do 1 because Log4j has a SyslogAppender that combines the 
appropriate Layout for you.

I’m getting frustrated because both Matt and I have already told you more than 
once that Log4j ships with a SyslogAppender. Just use it. If you can’t, tell us 
why.

Ralph


> On Feb 21, 2020, at 8:24 AM, EDMONDO SENA <edse...@gmail.com> wrote:
> 
> Hi Ralph,
> 
> we've send logs towards destination Syslog server.
> We cannot use SocketAppender because we've using Syslog protocol.
> 
> 
> 
> 
> On 2020/02/21 15:08:06, Ralph Goers <ralph.go...@dslextreme.com> wrote: 
>> I can’t answer that since I still don’t know what the problem is you are 
>> trying to solve.  Log4j 2 has an Appender interface. You could write a 
>> custom Appender that implements that, but that would be silly. Log4j 2’s 
>> SyslogAppender extends the SocketAppender, which extends 
>> AbstractOutputStreamAppender, which extends AbstractAppender. All of those 
>> are valid extension points. Log4j 2’s Appender interface has getName(), 
>> getErrorHandler() and getLayout() methods, but does not have a setName() or 
>> setLayout() method since those are provided in the constructor and are final.
>> 
>> AppenderSkeleton only exists in log4j-1.2-api for compatibility and will act 
>> as a no-op when you use a Log4j 2 configuration file. 
>> 
>> Again, what are you trying to do with syslog4j that Log4j 2’s SocketAppender 
>> doesn’t support?
>> 
>> Ralph
>> 
>> 
>> 
>>> On Feb 21, 2020, at 3:57 AM, EDMONDO SENA <edse...@gmail.com> wrote:
>>> 
>>> Hi Ralph,
>>> 
>>> How you know in lo4j1.x:
>>> 
>>> Syslog4jAppenderSkeleton extends org.apache.log4j.AppenderSkeleton 
>>> implements 
>>>                                                         
>>> org.productivity.java.syslog4j.SyslogConstants, now:
>>> 
>>> I need to use these methods for our scope, namely: 
>>> setLayout, getErrorHandler, setName.
>>> 
>>> Is possible to use these methods in Log4j 2 somehow?
>>> 
>>> 
>>> 
>>> On 2020/02/20 16:48:42, Ralph Goers <ralph.go...@dslextreme.com> wrote: 
>>>> Telling us that you overrode a class to fix a bug in the library doesn’t 
>>>> really help us much.  What are you using syslog4j for?  If you are simply 
>>>> trying to write log events to syslog Log4j 2 already supports that.
>>>> 
>>>> Ralph
>>>> 
>>>>> On Feb 20, 2020, at 8:30 AM, EDMONDO SENA <edse...@gmail.com> wrote:
>>>>> 
>>>>> That class has been created to face to a bug in a syslog4j library 
>>>>> related to the handling of identity when more Appenders are used within 
>>>>> the same VM.
>>>>> We've created some methods like:
>>>>> 
>>>>> - append(LoggingEvent...)
>>>>> - initialize() for the protocol
>>>>> - get() and set() SyslogHost....
>>>>> 
>>>>> 
>>>>> 
>>>>> On 2020/02/20 15:23:58, Matt Sicker <boa...@gmail.com> wrote: 
>>>>>> What did you customize about that old class? We likely already support 
>>>>>> the
>>>>>> same features you added in the v2 class. Can you tell us a little more
>>>>>> about your use case?
>>>>>> 
>>>>>> On Thu, Feb 20, 2020 at 09:22 EDMONDO SENA <edse...@gmail.com> wrote:
>>>>>> 
>>>>>>> 
>>>>>>> Well:
>>>>>>> 
>>>>>>> We're using Log4j 2 and we've a class that extends
>>>>>>> SysLog4jAppenderSkeleton where the import is:
>>>>>>> 
>>>>>>> org.productivity.java.syslog4j.impl.log4j.Syslog4jAppenderSkeleton..
>>>>>>> Changing the jars the
>>>>>>> previous class is inconsistent....
>>>>>>> 
>>>>>>> 
>>>>>>> On 2020/02/20 15:12:05, Ralph Goers <ralph.go...@dslextreme.com> wrote:
>>>>>>>> See
>>>>>>> http://logging.apache.org/log4j/2.x/manual/appenders.html#SyslogAppender
>>>>>>>  <
>>>>>>> http://logging.apache.org/log4j/2.x/manual/appenders.html#SyslogAppender>
>>>>>>>> 
>>>>>>>> Ralph
>>>>>>>> 
>>>>>>>>> On Feb 20, 2020, at 8:05 AM, EDMONDO SENA <edse...@gmail.com> wrote:
>>>>>>>>> 
>>>>>>>>> Sorry it means that now is it impossible to use syslog4j with log4j 2?
>>>>>>>>> What do you mean out of the box?
>>>>>>>>> 
>>>>>>>>> //Edmondo.
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> On 2020/02/20 15:01:25, Matt Sicker <boa...@gmail.com> wrote:
>>>>>>>>>> I’d guess no, but Log4j2 comes with syslog appenders out of the box
>>>>>>> now.
>>>>>>>>>> 
>>>>>>>>>> On Thu, Feb 20, 2020 at 04:30 EDMONDO SENA <edse...@gmail.com> wrote:
>>>>>>>>>> 
>>>>>>>>>>> Hi,
>>>>>>>>>>> 
>>>>>>>>>>> Syslog4j is compatible with Log4j 2?
>>>>>>>>>>> Kind regards.
>>>>>>>>>>> 
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>>>>>>>>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>>>>>>>>>> 
>>>>>>>>>>> --
>>>>>>>>>> Matt Sicker <boa...@gmail.com>
>>>>>>>>>> 
>>>>>>>>> 
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>>>>>>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>>>>>>>> 
>>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>> 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>>>>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>>>>>> 
>>>>>>> --
>>>>>> Matt Sicker <boa...@gmail.com>
>>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>>>> 
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>>> 
>>>> 
>>> 
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>>> 
>>> 
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
>> For additional commands, e-mail: log4j-user-h...@logging.apache.org
>> 
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org
> For additional commands, e-mail: log4j-user-h...@logging.apache.org
> 
> 

Reply via email to