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 Paladox <th...@yahoo.com.INVALID> on 2019/05/12 15:06:57 UTC
How to use “callAppenders” under log4j2
Hi, I’m currently stuck at “callAppenders” which appears to not exist.
log4j2/src/main/java/com/google/common/flogger/backend/log4j2/Log4j2LoggerBackend.java:76: error: cannot find symbol
logger.callAppenders(logEntry.asLoggingEvent());
Which is not in Logger like it was in Log4j1 I guess.
I’m not sure how to fix this so any help is appreciated please.
Re: How to use “callAppenders” under log4j2
Posted by Paladox <th...@yahoo.com.INVALID>.
Thanks for replying and sorry for late reply.
So I’m guessing I have to call the functions within LogEvent since logMessage does not take LogEvent.
Is it like logger.logMessage(logEntry.asLoggingEvent().getFQDN()...); ? (Not an example named param but example)
On Monday, 13 May 2019, 02:59:18 BST, Ralph Goers <ra...@dslextreme.com> wrote:
OK. I’ve glanced at the PR review comments and I understand what you want to do. I looked at the SLF4J implementation and it is not the way I would have implemented it. It essentially just wraps the SLF4J API instead of calling the SPI layer.
I’ve taken a look at you latest commit and it looks close to what I would have recommended, although I would have recommended you use the logMessage method instead of calling get() on the Logger. I have a suspicion you are going to run into errors if you bypass the ReliabilityStrategy as you are doing.
Ralph
> On May 12, 2019, at 6:15 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>
> Even after following the link I still have no idea what you are trying to accomplish. Can you explain it using words?
>
> As for the code below I don’t see how it will do anything useful. You have created a LoggerConfig that isn’t associated with a Configuration and has no elements attached to it so the call to the log method is going to result in nothing happening.
>
> Ralph
>
>> On May 12, 2019, at 9:47 AM, Paladox <th...@yahoo.com.INVALID> wrote:
>>
>> I think i've found a way to do this, would doing this:
>> LoggerConfig loggerConfig = new LoggerConfig(logger.toString(), null, false); loggerConfig.log(logEntry.asLoggingEvent());
>> be the equivalent?
>> On Sunday, 12 May 2019, 16:49:06 BST, Paladox <th...@yahoo.com.INVALID> wrote:
>>
>> Thanks for replying, I’m trying to do https://github.com/google/flogger/pull/82/files#diff-9a6ef9c14f03fa6a0ad09da1dd5707f3R74 (Even though it’s a new file it’s a copy from the log4j1 version in that repo but modified for log4j2)
>> On Sunday, 12 May 2019, 16:44:13 BST, Apache <ra...@dslextreme.com> wrote:
>>
>> What are you trying to do?
>>
>> Ralph
>>
>>> On May 12, 2019, at 8:06 AM, Paladox <th...@yahoo.com.invalid> wrote:
>>>
>>> Hi, I’m currently stuck at “callAppenders” which appears to not exist.
>>> log4j2/src/main/java/com/google/common/flogger/backend/log4j2/Log4j2LoggerBackend.java:76: error: cannot find symbol
>>>
>>> logger.callAppenders(logEntry.asLoggingEvent());
>>>
>>>
>>>
>>>
>>> Which is not in Logger like it was in Log4j1 I guess.
>>>
>>> I’m not sure how to fix this so any help is appreciated please.
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: How to use “callAppenders” under log4j2
Posted by Ralph Goers <ra...@dslextreme.com>.
OK. I’ve glanced at the PR review comments and I understand what you want to do. I looked at the SLF4J implementation and it is not the way I would have implemented it. It essentially just wraps the SLF4J API instead of calling the SPI layer.
I’ve taken a look at you latest commit and it looks close to what I would have recommended, although I would have recommended you use the logMessage method instead of calling get() on the Logger. I have a suspicion you are going to run into errors if you bypass the ReliabilityStrategy as you are doing.
Ralph
> On May 12, 2019, at 6:15 PM, Ralph Goers <ra...@dslextreme.com> wrote:
>
> Even after following the link I still have no idea what you are trying to accomplish. Can you explain it using words?
>
> As for the code below I don’t see how it will do anything useful. You have created a LoggerConfig that isn’t associated with a Configuration and has no elements attached to it so the call to the log method is going to result in nothing happening.
>
> Ralph
>
>> On May 12, 2019, at 9:47 AM, Paladox <th...@yahoo.com.INVALID> wrote:
>>
>> I think i've found a way to do this, would doing this:
>> LoggerConfig loggerConfig = new LoggerConfig(logger.toString(), null, false); loggerConfig.log(logEntry.asLoggingEvent());
>> be the equivalent?
>> On Sunday, 12 May 2019, 16:49:06 BST, Paladox <th...@yahoo.com.INVALID> wrote:
>>
>> Thanks for replying, I’m trying to do https://github.com/google/flogger/pull/82/files#diff-9a6ef9c14f03fa6a0ad09da1dd5707f3R74 (Even though it’s a new file it’s a copy from the log4j1 version in that repo but modified for log4j2)
>> On Sunday, 12 May 2019, 16:44:13 BST, Apache <ra...@dslextreme.com> wrote:
>>
>> What are you trying to do?
>>
>> Ralph
>>
>>> On May 12, 2019, at 8:06 AM, Paladox <th...@yahoo.com.invalid> wrote:
>>>
>>> Hi, I’m currently stuck at “callAppenders” which appears to not exist.
>>> log4j2/src/main/java/com/google/common/flogger/backend/log4j2/Log4j2LoggerBackend.java:76: error: cannot find symbol
>>>
>>> logger.callAppenders(logEntry.asLoggingEvent());
>>>
>>>
>>>
>>>
>>> Which is not in Logger like it was in Log4j1 I guess.
>>>
>>> I’m not sure how to fix this so any help is appreciated please.
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: How to use “callAppenders” under log4j2
Posted by Ralph Goers <ra...@dslextreme.com>.
Even after following the link I still have no idea what you are trying to accomplish. Can you explain it using words?
As for the code below I don’t see how it will do anything useful. You have created a LoggerConfig that isn’t associated with a Configuration and has no elements attached to it so the call to the log method is going to result in nothing happening.
Ralph
> On May 12, 2019, at 9:47 AM, Paladox <th...@yahoo.com.INVALID> wrote:
>
> I think i've found a way to do this, would doing this:
> LoggerConfig loggerConfig = new LoggerConfig(logger.toString(), null, false); loggerConfig.log(logEntry.asLoggingEvent());
> be the equivalent?
> On Sunday, 12 May 2019, 16:49:06 BST, Paladox <th...@yahoo.com.INVALID> wrote:
>
> Thanks for replying, I’m trying to do https://github.com/google/flogger/pull/82/files#diff-9a6ef9c14f03fa6a0ad09da1dd5707f3R74 (Even though it’s a new file it’s a copy from the log4j1 version in that repo but modified for log4j2)
> On Sunday, 12 May 2019, 16:44:13 BST, Apache <ra...@dslextreme.com> wrote:
>
> What are you trying to do?
>
> Ralph
>
>> On May 12, 2019, at 8:06 AM, Paladox <th...@yahoo.com.invalid> wrote:
>>
>> Hi, I’m currently stuck at “callAppenders” which appears to not exist.
>> log4j2/src/main/java/com/google/common/flogger/backend/log4j2/Log4j2LoggerBackend.java:76: error: cannot find symbol
>>
>> logger.callAppenders(logEntry.asLoggingEvent());
>>
>>
>>
>>
>> Which is not in Logger like it was in Log4j1 I guess.
>>
>> I’m not sure how to fix this so any help is appreciated please.
>
>
>
> ---------------------------------------------------------------------
> 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 to use “callAppenders” under log4j2
Posted by Paladox <th...@yahoo.com.INVALID>.
I think i've found a way to do this, would doing this:
LoggerConfig loggerConfig = new LoggerConfig(logger.toString(), null, false); loggerConfig.log(logEntry.asLoggingEvent());
be the equivalent?
On Sunday, 12 May 2019, 16:49:06 BST, Paladox <th...@yahoo.com.INVALID> wrote:
Thanks for replying, I’m trying to do https://github.com/google/flogger/pull/82/files#diff-9a6ef9c14f03fa6a0ad09da1dd5707f3R74 (Even though it’s a new file it’s a copy from the log4j1 version in that repo but modified for log4j2)
On Sunday, 12 May 2019, 16:44:13 BST, Apache <ra...@dslextreme.com> wrote:
What are you trying to do?
Ralph
> On May 12, 2019, at 8:06 AM, Paladox <th...@yahoo.com.invalid> wrote:
>
> Hi, I’m currently stuck at “callAppenders” which appears to not exist.
> log4j2/src/main/java/com/google/common/flogger/backend/log4j2/Log4j2LoggerBackend.java:76: error: cannot find symbol
>
> logger.callAppenders(logEntry.asLoggingEvent());
>
>
>
>
> Which is not in Logger like it was in Log4j1 I guess.
>
> I’m not sure how to fix this so any help is appreciated please.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: How to use “callAppenders” under log4j2
Posted by Paladox <th...@yahoo.com.INVALID>.
Thanks for replying, I’m trying to do https://github.com/google/flogger/pull/82/files#diff-9a6ef9c14f03fa6a0ad09da1dd5707f3R74 (Even though it’s a new file it’s a copy from the log4j1 version in that repo but modified for log4j2)
On Sunday, 12 May 2019, 16:44:13 BST, Apache <ra...@dslextreme.com> wrote:
What are you trying to do?
Ralph
> On May 12, 2019, at 8:06 AM, Paladox <th...@yahoo.com.invalid> wrote:
>
> Hi, I’m currently stuck at “callAppenders” which appears to not exist.
> log4j2/src/main/java/com/google/common/flogger/backend/log4j2/Log4j2LoggerBackend.java:76: error: cannot find symbol
>
> logger.callAppenders(logEntry.asLoggingEvent());
>
>
>
>
> Which is not in Logger like it was in Log4j1 I guess.
>
> I’m not sure how to fix this so any help is appreciated please.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org
Re: How to use “callAppenders” under log4j2
Posted by Apache <ra...@dslextreme.com>.
What are you trying to do?
Ralph
> On May 12, 2019, at 8:06 AM, Paladox <th...@yahoo.com.invalid> wrote:
>
> Hi, I’m currently stuck at “callAppenders” which appears to not exist.
> log4j2/src/main/java/com/google/common/flogger/backend/log4j2/Log4j2LoggerBackend.java:76: error: cannot find symbol
>
> logger.callAppenders(logEntry.asLoggingEvent());
>
>
>
>
> Which is not in Logger like it was in Log4j1 I guess.
>
> I’m not sure how to fix this so any help is appreciated please.
---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org