[jira] [Commented] (LOGCXX-532) Static objects and deleting
[ https://issues.apache.org/jira/browse/LOGCXX-532?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465985#comment-17465985 ] Dr Stephen L S Webb commented on LOGCXX-532: What do you think about removing all static ObjectPtr instances and instead using the single instance of APRInitializer? APRInitialiser could hold a map of named ObjectPtr's. > Static objects and deleting > --- > > Key: LOGCXX-532 > URL: https://issues.apache.org/jira/browse/LOGCXX-532 > Project: Log4cxx > Issue Type: Improvement >Reporter: Robert Middleton >Assignee: Robert Middleton >Priority: Minor > > As seen in LOGCXX-430 and LOGCXX-322, making sure that when an application > terminates earlier than expected we don't crash is rather hard to do. > I came across this solution when researching this problem: > https://stackoverflow.com/a/470545/624483 > My thought is that we create something like a log4cxx::Globals class, which > contains a smart pointer to everything that must be kept alive before the > library can safely be unloaded. In each thread, you would do something like: > {{GlobalsPtr globals = log4cxx::globals;}} > thus ensuring that the destructor can't run before all of the threads are > stopped. This would be up to the user of the library. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [logging-log4cxx] swebb2066 opened a new pull request #92: Allow throughputtests to be built when LOGCHAR_IS_WCHAR is on
swebb2066 opened a new pull request #92: URL: https://github.com/apache/logging-log4cxx/pull/92 This change adorns literal strings within LOG4CXX_STR where required. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4cxx] swebb2066 commented on pull request #91: Allow throughputtests to be built when LOG4CXX_LOGCHAR_IS_WCHAR is on
swebb2066 commented on pull request #91: URL: https://github.com/apache/logging-log4cxx/pull/91#issuecomment-1001858047 Duplicates #90 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4cxx] swebb2066 closed pull request #91: Allow throughputtests to be built when LOG4CXX_LOGCHAR_IS_WCHAR is on
swebb2066 closed pull request #91: URL: https://github.com/apache/logging-log4cxx/pull/91 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4cxx] swebb2066 opened a new pull request #91: Allow throughputtests to be built when LOG4CXX_LOGCHAR_IS_WCHAR is on
swebb2066 opened a new pull request #91: URL: https://github.com/apache/logging-log4cxx/pull/91 This PR completes #87 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (LOG4J2-2819) Add support for specifying an SSL configuration for SmtpAppender
[ https://issues.apache.org/jira/browse/LOG4J2-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465911#comment-17465911 ] ASF subversion and git services commented on LOG4J2-2819: - Commit 3c62f0bea692456b1b5039d3bcc1c3e0ba65146a in logging-log4j2's branch refs/heads/log4j-2.3.x from Matt Sicker [ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=3c62f0b ] [LOG4J2-2819] Add SSL/TLS hostname verify option This backports a fix for CVE-2020-9488. > Add support for specifying an SSL configuration for SmtpAppender > > > Key: LOG4J2-2819 > URL: https://issues.apache.org/jira/browse/LOG4J2-2819 > Project: Log4j 2 > Issue Type: Improvement > Components: Appenders >Affects Versions: 2.13.1 >Reporter: Matt Sicker >Assignee: Matt Sicker >Priority: Major > Fix For: 2.13.2, 2.12.3, 2.3.2 > > > The SmtpAppender should be able to use an SSL configuration element to > specify a trust store, host name verification, and a key store, so that smtps > connections can be further configured. This should re-use the same {{}} > configuration element that's used elsewhere like HttpAppender. > h2. CVE-2020-9488 > The SmtpAppender did not verify the host name matched the SSL/TLS certificate > of an SMTPS connection which could allow an attacker with man-in-the-middle > access to intercept log messages sent through SMTPS. > h3. Mitigation > Upgrade to 2.13.2 which supports this feature. Previous versions can set the > system property {{mail.smtp.ssl.checkserveridentity}} to {{true}} to globally > enable hostname verification for SMTPS connections. > h3. Details > CWE: 297 > CVSS: 3.7 (Low) CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N > Reporter: Peter Stöckli -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (LOG4J2-2819) Add support for specifying an SSL configuration for SmtpAppender
[ https://issues.apache.org/jira/browse/LOG4J2-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465886#comment-17465886 ] Matt Sicker commented on LOG4J2-2819: - I'll be backporting this issue to 2.3.2 in an upcoming release. > Add support for specifying an SSL configuration for SmtpAppender > > > Key: LOG4J2-2819 > URL: https://issues.apache.org/jira/browse/LOG4J2-2819 > Project: Log4j 2 > Issue Type: Improvement > Components: Appenders >Affects Versions: 2.13.1 >Reporter: Matt Sicker >Assignee: Matt Sicker >Priority: Major > Fix For: 2.13.2, 2.12.3, 2.3.2 > > > The SmtpAppender should be able to use an SSL configuration element to > specify a trust store, host name verification, and a key store, so that smtps > connections can be further configured. This should re-use the same {{}} > configuration element that's used elsewhere like HttpAppender. > h2. CVE-2020-9488 > The SmtpAppender did not verify the host name matched the SSL/TLS certificate > of an SMTPS connection which could allow an attacker with man-in-the-middle > access to intercept log messages sent through SMTPS. > h3. Mitigation > Upgrade to 2.13.2 which supports this feature. Previous versions can set the > system property {{mail.smtp.ssl.checkserveridentity}} to {{true}} to globally > enable hostname verification for SMTPS connections. > h3. Details > CWE: 297 > CVSS: 3.7 (Low) CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N > Reporter: Peter Stöckli -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Updated] (LOG4J2-2819) Add support for specifying an SSL configuration for SmtpAppender
[ https://issues.apache.org/jira/browse/LOG4J2-2819?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Matt Sicker updated LOG4J2-2819: Fix Version/s: 2.3.2 > Add support for specifying an SSL configuration for SmtpAppender > > > Key: LOG4J2-2819 > URL: https://issues.apache.org/jira/browse/LOG4J2-2819 > Project: Log4j 2 > Issue Type: Improvement > Components: Appenders >Affects Versions: 2.13.1 >Reporter: Matt Sicker >Assignee: Matt Sicker >Priority: Major > Fix For: 2.13.2, 2.12.3, 2.3.2 > > > The SmtpAppender should be able to use an SSL configuration element to > specify a trust store, host name verification, and a key store, so that smtps > connections can be further configured. This should re-use the same {{}} > configuration element that's used elsewhere like HttpAppender. > h2. CVE-2020-9488 > The SmtpAppender did not verify the host name matched the SSL/TLS certificate > of an SMTPS connection which could allow an attacker with man-in-the-middle > access to intercept log messages sent through SMTPS. > h3. Mitigation > Upgrade to 2.13.2 which supports this feature. Previous versions can set the > system property {{mail.smtp.ssl.checkserveridentity}} to {{true}} to globally > enable hostname verification for SMTPS connections. > h3. Details > CWE: 297 > CVSS: 3.7 (Low) CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N > Reporter: Peter Stöckli -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (LOG4J2-3290) NetUtils.getLocalIps() is error-prone
[ https://issues.apache.org/jira/browse/LOG4J2-3290?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465865#comment-17465865 ] ASF subversion and git services commented on LOG4J2-3290: - Commit f60e4edee46e9782a42acac93ccb24a85392e5bc in logging-log4j2's branch refs/heads/release-2.x from Ralph Goers [ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=f60e4ed ] LOG4J2-3290. Remove unused method > NetUtils.getLocalIps() is error-prone > - > > Key: LOG4J2-3290 > URL: https://issues.apache.org/jira/browse/LOG4J2-3290 > Project: Log4j 2 > Issue Type: Bug >Reporter: Marcono1234 >Priority: Minor > > The method {{org.apache.logging.log4j.core.util.NetUtils.getLocalIps()}} is > error-prone: > - It does not document in which format the returned IP addresses are. IPv6 > addresses are not enclosed in square brackets, and may have an optional scope > id, e.g. {{1080:0:0:0:8:800:200C:417A%eth3}}. This should be documented > because some callers might expect enclosing square brackets. > - It does not include the short form of the IPv6 loopback address: {{::1}} > - Its results include temporary IP addresses. This causes the following > issues, when during the runtime of an application the IP addresses are > re-assigned by the provider: > -- If the results of {{getLocalIps()}} were cached, parts of the application > might break due to IP address change, because the newly assigned IP address > is not considered a 'local IP' anymore. > -- It might allow circumventing IP address filters when a malicious actor > manages to get the previous IP address as their new address. > {{NetUtils.getLocalIps()}} was only introduced for {{JndiManager}}, however > with the recent changes the method does not appear to be used anymore (see > LOG4J2-3242). Therefore, it might also be an option to remove the method > again. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (LOG4J2-3288) Interpolator non-plugin codepath doesn't include all log4j-core lookups
[ https://issues.apache.org/jira/browse/LOG4J2-3288?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465857#comment-17465857 ] ASF subversion and git services commented on LOG4J2-3288: - Commit 14f0bd06e64a1dd2c13b7deda7380fe9a2b7c755 in logging-log4j2's branch refs/heads/release-2.x from Carter Kozak [ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=14f0bd0 ] Revert "LOG4J2-3288 Interpolator non-plugin ctor includes all core lookups" This reverts commit 68fdfcec221ec9458ee0fd83d97d95977c4b54b7. > Interpolator non-plugin codepath doesn't include all log4j-core lookups > --- > > Key: LOG4J2-3288 > URL: https://issues.apache.org/jira/browse/LOG4J2-3288 > Project: Log4j 2 > Issue Type: Bug > Components: Configuration, Core >Affects Versions: 2.17.0 >Reporter: Carter Kozak >Assignee: Carter Kozak >Priority: Major > Fix For: 2.17.1 > > > It appears that {{bundle}} {{{}event{}}}, and {{sd}} lookups are not > registered. > There's a comment suggesting that the PluginManager could be used, however > that will require additional validation before I'm comfortable enabling it: > Logging initialization is very static and tricky, and it's easy to produce > deadlocks when referencing logging code within initialization. -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [logging-log4j2] vorburger commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
vorburger commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775609860 ## File path: log4j-to-jul/src/main/java/org/apache/logging/log4j/tojul/JULLogger.java ## @@ -0,0 +1,246 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.tojul; + +import static java.util.Objects.requireNonNull; + +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.spi.AbstractLogger; + +/** + * Implementation of {@link org.apache.logging.log4j.Logger} that's backed by a {@link Logger}. + * + * This implementation currently ignores {@link Marker}. + * + * @author http://www.vorburger.ch";>Michael Vorburger.ch for Google + */ +public class JULLogger extends AbstractLogger { Review comment: Thanks! Resolving. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] vorburger commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
vorburger commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775609433 ## File path: log4j-to-jul/src/main/java/org/apache/logging/log4j/tojul/JULLogger.java ## @@ -0,0 +1,246 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.tojul; + +import static java.util.Objects.requireNonNull; + +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.spi.AbstractLogger; + +/** + * Implementation of {@link org.apache.logging.log4j.Logger} that's backed by a {@link Logger}. + * + * This implementation currently ignores {@link Marker}. + * + * @author http://www.vorburger.ch";>Michael Vorburger.ch for Google + */ +public class JULLogger extends AbstractLogger { +private static final long serialVersionUID = 1L; + +// @VisibleForTesting +final Logger logger; + +// This implementation is inspired by org.apache.logging.slf4j.SLF4JLogger + +public JULLogger(final String name, final MessageFactory messageFactory, final Logger logger) { +super(name, messageFactory); +this.logger = requireNonNull(logger, "logger"); +} + +public JULLogger(final String name, final Logger logger) { +super(name); +this.logger = requireNonNull(logger, "logger"); +} + +@Override +public void logMessage(final String fqcn, final Level level, final Marker marker, final Message message, final Throwable t) { +java.util.logging.Level julLevel = convertLevel(level); +if (!logger.isLoggable(julLevel)) { +return; +} +LogRecord record = new LogRecord(julLevel, message.getFormattedMessage()); // TODO getFormat() or getFormattedMessage() ? +record.setLoggerName(getName()); // TODO getName() or fqcn parameter? What's that? +record.setParameters(message.getParameters()); Review comment: 2. Is now all that's really left to do here (from my side); I'll look more into on one of the next few days, and then un-draft this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] vorburger commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
vorburger commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775609043 ## File path: pom.xml ## @@ -964,6 +964,19 @@ 0.8.1 test + +com.google.guava + +guava-testlib +31.0.1-jre +test + + +com.google.truth +truth +1.1.3 +test + Review comment: Huh - AssertJ and Truth are 99% (`isSameInstanceAs` => `isSameAs`) API compatible! COOL. Done. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] carterkozak commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
carterkozak commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775607939 ## File path: log4j-to-jul/src/main/java/org/apache/logging/log4j/tojul/JULLogger.java ## @@ -0,0 +1,246 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.tojul; + +import static java.util.Objects.requireNonNull; + +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.spi.AbstractLogger; + +/** + * Implementation of {@link org.apache.logging.log4j.Logger} that's backed by a {@link Logger}. + * + * This implementation currently ignores {@link Marker}. + * + * @author http://www.vorburger.ch";>Michael Vorburger.ch for Google + */ +public class JULLogger extends AbstractLogger { Review comment: Of course :-) The final class means we don't have to design or review for all the ways an external consumer may decide to extend this class. This way we don't need to review as many edge cases, and we have much greater flexibility to change the class in the future without causing odd semantic breaks. I don't believe there's any measurable performance impact (C2 should be able to optimize non-final and final methods similarly if the receiver type is always the same. Also, bytecode manipulation allows final classes to be subclassed, e.g. Mockito + inline mock maker) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] vorburger commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
vorburger commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775607662 ## File path: pom.xml ## @@ -964,6 +964,19 @@ 0.8.1 test + +com.google.guava + +guava-testlib +31.0.1-jre +test + + +com.google.truth +truth +1.1.3 +test + Review comment: ACK, then I'll rework this to use AssertJ instead of Truth, no worries. (FYI I've added additional tests just now.) Expected timeframe: Coming couple of days, hopefully some time this week (but not today anymore and unlikely tomorrow). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] ramananravi commented on pull request #671: add support for FileSize in TB
ramananravi commented on pull request #671: URL: https://github.com/apache/logging-log4j2/pull/671#issuecomment-1001690144 Currently the default value of 'exceeds' attribute of 'IfAccumulatedFileSize' is Long.MAX_VALUE, which is considerably larger than 1000 TB itself. Hence adding support for specifying 'exceeds' parameter in TB (TeraBytes). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] carterkozak commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
carterkozak commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775604539 ## File path: log4j-to-jul/src/main/java/org/apache/logging/log4j/tojul/JULLogger.java ## @@ -0,0 +1,246 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.tojul; + +import static java.util.Objects.requireNonNull; + +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.spi.AbstractLogger; + +/** + * Implementation of {@link org.apache.logging.log4j.Logger} that's backed by a {@link Logger}. + * + * This implementation currently ignores {@link Marker}. + * + * @author http://www.vorburger.ch";>Michael Vorburger.ch for Google + */ +public class JULLogger extends AbstractLogger { +private static final long serialVersionUID = 1L; + +// @VisibleForTesting +final Logger logger; + +// This implementation is inspired by org.apache.logging.slf4j.SLF4JLogger + +public JULLogger(final String name, final MessageFactory messageFactory, final Logger logger) { +super(name, messageFactory); +this.logger = requireNonNull(logger, "logger"); +} + +public JULLogger(final String name, final Logger logger) { +super(name); +this.logger = requireNonNull(logger, "logger"); +} + +@Override +public void logMessage(final String fqcn, final Level level, final Marker marker, final Message message, final Throwable t) { +java.util.logging.Level julLevel = convertLevel(level); +if (!logger.isLoggable(julLevel)) { +return; +} +LogRecord record = new LogRecord(julLevel, message.getFormattedMessage()); // TODO getFormat() or getFormattedMessage() ? +record.setLoggerName(getName()); // TODO getName() or fqcn parameter? What's that? +record.setParameters(message.getParameters()); Review comment: 1: That's exactly right, thanks! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] carterkozak commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
carterkozak commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775604217 ## File path: pom.xml ## @@ -964,6 +964,19 @@ 0.8.1 test + +com.google.guava + +guava-testlib +31.0.1-jre +test + + +com.google.truth +truth +1.1.3 +test + Review comment: I think Gary meant to reply to https://github.com/apache/logging-log4j2/pull/653#discussion_r775083886 I haven't used the Truth library outside of perhaps a couple bug-fixes in guava/error-prone. I will be able to review much more quickly and easily if you use frameworks I'm familiar with. Truth appears to bring in a few large transitive dependencies as well. Unless we're consolidating all the assertj/junit asserts into truth, we're probably better off avoiding [the lava layer](http://mikehadlow.blogspot.com/2014/12/the-lava-layer-anti-pattern.html). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] carterkozak commented on a change in pull request #644: LOG4J2-3259: Limit max recursion depth when interpolating strings.
carterkozak commented on a change in pull request #644: URL: https://github.com/apache/logging-log4j2/pull/644#discussion_r775600190 ## File path: log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java ## @@ -986,12 +986,20 @@ protected boolean substitute(final LogEvent event, final StringBuilder buf, fina * @param buf the string builder to substitute into, not null * @param offset the start offset within the builder, must be valid * @param length the length within the builder to be processed, must be valid + * @param recursionDepth the current recursion depth, strings exceeding 10 recursions + * will not be fully interpolated, and will cause an error to be logged. * @param priorVariables the stack keeping track of the replaced variables, may be null * @return the length change that occurs, unless priorVariables is null when the int * represents a boolean flag as to whether any change occurred. */ private int substitute(final LogEvent event, final StringBuilder buf, final int offset, final int length, - List priorVariables) { + final int recursionDepth, List priorVariables) { +int maxRecursionDepth = 10; +if (recursionDepth >= maxRecursionDepth) { +StatusLogger.getLogger().error("Property interpolation exceeded recursion depth of {}. Replacement failed on '{}'", +maxRecursionDepth, buf.toString()); +return 0; Review comment: ~~I don't think zero is the correct result, should there be additional test coverage showing that?~~ edit: I think I'm incorrect here, otherwise the `isRecursiveEvaluationAllowed` check below would be wrong -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] carterkozak commented on a change in pull request #644: LOG4J2-3259: Limit max recursion depth when interpolating strings.
carterkozak commented on a change in pull request #644: URL: https://github.com/apache/logging-log4j2/pull/644#discussion_r775600190 ## File path: log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java ## @@ -986,12 +986,20 @@ protected boolean substitute(final LogEvent event, final StringBuilder buf, fina * @param buf the string builder to substitute into, not null * @param offset the start offset within the builder, must be valid * @param length the length within the builder to be processed, must be valid + * @param recursionDepth the current recursion depth, strings exceeding 10 recursions + * will not be fully interpolated, and will cause an error to be logged. * @param priorVariables the stack keeping track of the replaced variables, may be null * @return the length change that occurs, unless priorVariables is null when the int * represents a boolean flag as to whether any change occurred. */ private int substitute(final LogEvent event, final StringBuilder buf, final int offset, final int length, - List priorVariables) { + final int recursionDepth, List priorVariables) { +int maxRecursionDepth = 10; +if (recursionDepth >= maxRecursionDepth) { +StatusLogger.getLogger().error("Property interpolation exceeded recursion depth of {}. Replacement failed on '{}'", +maxRecursionDepth, buf.toString()); +return 0; Review comment: I don't think zero is the correct result, should there be additional test coverage showing that? edit: I think I'm incorrect here, otherwise the `isRecursiveEvaluationAllowed` check below would be wrong -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] carterkozak commented on a change in pull request #644: LOG4J2-3259: Limit max recursion depth when interpolating strings.
carterkozak commented on a change in pull request #644: URL: https://github.com/apache/logging-log4j2/pull/644#discussion_r775600190 ## File path: log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/StrSubstitutor.java ## @@ -986,12 +986,20 @@ protected boolean substitute(final LogEvent event, final StringBuilder buf, fina * @param buf the string builder to substitute into, not null * @param offset the start offset within the builder, must be valid * @param length the length within the builder to be processed, must be valid + * @param recursionDepth the current recursion depth, strings exceeding 10 recursions + * will not be fully interpolated, and will cause an error to be logged. * @param priorVariables the stack keeping track of the replaced variables, may be null * @return the length change that occurs, unless priorVariables is null when the int * represents a boolean flag as to whether any change occurred. */ private int substitute(final LogEvent event, final StringBuilder buf, final int offset, final int length, - List priorVariables) { + final int recursionDepth, List priorVariables) { +int maxRecursionDepth = 10; +if (recursionDepth >= maxRecursionDepth) { +StatusLogger.getLogger().error("Property interpolation exceeded recursion depth of {}. Replacement failed on '{}'", +maxRecursionDepth, buf.toString()); +return 0; Review comment: I don't think zero is the correct result, should there be additional test coverage showing that? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Closed] (LOG4J2-3292) ExtendedLoggerWrapper.logMessage double-logs when location is requested
[ https://issues.apache.org/jira/browse/LOG4J2-3292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Carter Kozak closed LOG4J2-3292. > ExtendedLoggerWrapper.logMessage double-logs when location is requested > --- > > Key: LOG4J2-3292 > URL: https://issues.apache.org/jira/browse/LOG4J2-3292 > Project: Log4j 2 > Issue Type: Bug > Components: API >Affects Versions: 2.17.0 >Reporter: Carter Kozak >Assignee: Carter Kozak >Priority: Major > Fix For: 2.17.1 > > > See https://github.com/apache/logging-log4j2/pull/667 -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Commented] (LOG4J2-3292) ExtendedLoggerWrapper.logMessage double-logs when location is requested
[ https://issues.apache.org/jira/browse/LOG4J2-3292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465827#comment-17465827 ] ASF subversion and git services commented on LOG4J2-3292: - Commit 57a350a83f42d9544c2b9169ac1ff5ae1ed3c9a2 in logging-log4j2's branch refs/heads/master from Carter Kozak [ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=57a350a ] LOG4J2-3292: Fix ExtendedLoggerWrapper.logMessage double-logging Previously when the logger instance was location-aware and the logger was configured to require location info, both branches were invoked rather than only the location-aware branch. > ExtendedLoggerWrapper.logMessage double-logs when location is requested > --- > > Key: LOG4J2-3292 > URL: https://issues.apache.org/jira/browse/LOG4J2-3292 > Project: Log4j 2 > Issue Type: Bug > Components: API >Affects Versions: 2.17.0 >Reporter: Carter Kozak >Assignee: Carter Kozak >Priority: Major > Fix For: 2.17.1 > > > See https://github.com/apache/logging-log4j2/pull/667 -- This message was sent by Atlassian Jira (v8.20.1#820001)
[jira] [Resolved] (LOG4J2-3292) ExtendedLoggerWrapper.logMessage double-logs when location is requested
[ https://issues.apache.org/jira/browse/LOG4J2-3292?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Carter Kozak resolved LOG4J2-3292. -- Resolution: Fixed > ExtendedLoggerWrapper.logMessage double-logs when location is requested > --- > > Key: LOG4J2-3292 > URL: https://issues.apache.org/jira/browse/LOG4J2-3292 > Project: Log4j 2 > Issue Type: Bug > Components: API >Affects Versions: 2.17.0 >Reporter: Carter Kozak >Assignee: Carter Kozak >Priority: Major > Fix For: 2.17.1 > > > See https://github.com/apache/logging-log4j2/pull/667 -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [logging-log4j2] ramananravi closed pull request #670: add support for FileSize in TB
ramananravi closed pull request #670: URL: https://github.com/apache/logging-log4j2/pull/670 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (LOG4J2-3292) ExtendedLoggerWrapper.logMessage double-logs when location is requested
[ https://issues.apache.org/jira/browse/LOG4J2-3292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465825#comment-17465825 ] ASF subversion and git services commented on LOG4J2-3292: - Commit e1b232236026b77f4878d8dc599ade2873ce82de in logging-log4j2's branch refs/heads/release-2.x from Carter Kozak [ https://gitbox.apache.org/repos/asf?p=logging-log4j2.git;h=e1b2322 ] LOG4J2-3292: Fix ExtendedLoggerWrapper.logMessage double-logging Previously when the logger instance was location-aware and the logger was configured to require location info, both branches were invoked rather than only the location-aware branch. > ExtendedLoggerWrapper.logMessage double-logs when location is requested > --- > > Key: LOG4J2-3292 > URL: https://issues.apache.org/jira/browse/LOG4J2-3292 > Project: Log4j 2 > Issue Type: Bug > Components: API >Affects Versions: 2.17.0 >Reporter: Carter Kozak >Assignee: Carter Kozak >Priority: Major > Fix For: 2.17.1 > > > See https://github.com/apache/logging-log4j2/pull/667 -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [logging-log4j2] carterkozak merged pull request #667: LOG4J2-3292 Fix ExtendedLoggerWrapper.logMessage double-logging
carterkozak merged pull request #667: URL: https://github.com/apache/logging-log4j2/pull/667 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Created] (LOG4J2-3292) ExtendedLoggerWrapper.logMessage double-logs when location is requested
Carter Kozak created LOG4J2-3292: Summary: ExtendedLoggerWrapper.logMessage double-logs when location is requested Key: LOG4J2-3292 URL: https://issues.apache.org/jira/browse/LOG4J2-3292 Project: Log4j 2 Issue Type: Bug Components: API Affects Versions: 2.17.0 Reporter: Carter Kozak Assignee: Carter Kozak Fix For: 2.17.1 See https://github.com/apache/logging-log4j2/pull/667 -- This message was sent by Atlassian Jira (v8.20.1#820001)
[GitHub] [logging-log4j2] ramananravi commented on pull request #670: add support for FileSize in TB
ramananravi commented on pull request #670: URL: https://github.com/apache/logging-log4j2/pull/670#issuecomment-1001669932 Currently the default value of 'exceeds' attribute of 'IfAccumulatedFileSize' is Long.MAX_VALUE, which is considerably larger than 1000 TB itself. Hence adding support for specifying 'exceeds' parameter in TB (TeraBytes). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] vorburger commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
vorburger commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775577767 ## File path: log4j-to-jul/src/main/java/org/apache/logging/log4j/tojul/JULLogger.java ## @@ -0,0 +1,246 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.tojul; + +import static java.util.Objects.requireNonNull; + +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.spi.AbstractLogger; + +/** + * Implementation of {@link org.apache.logging.log4j.Logger} that's backed by a {@link Logger}. + * + * This implementation currently ignores {@link Marker}. + * + * @author http://www.vorburger.ch";>Michael Vorburger.ch for Google + */ +public class JULLogger extends AbstractLogger { +private static final long serialVersionUID = 1L; + +// @VisibleForTesting +final Logger logger; + +// This implementation is inspired by org.apache.logging.slf4j.SLF4JLogger + +public JULLogger(final String name, final MessageFactory messageFactory, final Logger logger) { +super(name, messageFactory); +this.logger = requireNonNull(logger, "logger"); +} + +public JULLogger(final String name, final Logger logger) { +super(name); +this.logger = requireNonNull(logger, "logger"); +} + +@Override +public void logMessage(final String fqcn, final Level level, final Marker marker, final Message message, final Throwable t) { +java.util.logging.Level julLevel = convertLevel(level); +if (!logger.isLoggable(julLevel)) { +return; +} +LogRecord record = new LogRecord(julLevel, message.getFormattedMessage()); // TODO getFormat() or getFormattedMessage() ? +record.setLoggerName(getName()); // TODO getName() or fqcn parameter? What's that? +record.setParameters(message.getParameters()); Review comment: 1. So KEEP `new LogRecord(julLevel, message.getFormattedMessage())` as-is, and REMOVE the `// TODO getFormat() or getFormattedMessage() ?` AND also remove the `record.setParameters(message.getParameters());` - am I getting this right? I've done this now, could you just double check I got this right and ACK 1. is fine. 2. I see. Let me get back to that point. (As I'm adding more test coverage I'm finding that other -more basic- things need a bit more work, first.) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] vorburger commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
vorburger commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775575152 ## File path: log4j-to-jul/src/main/java/org/apache/logging/log4j/tojul/JULLogger.java ## @@ -0,0 +1,246 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.tojul; + +import static java.util.Objects.requireNonNull; + +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.spi.AbstractLogger; + +/** + * Implementation of {@link org.apache.logging.log4j.Logger} that's backed by a {@link Logger}. + * + * This implementation currently ignores {@link Marker}. + * + * @author http://www.vorburger.ch";>Michael Vorburger.ch for Google + */ +public class JULLogger extends AbstractLogger { Review comment: Sure, done. May I ask why, just for learning? Does this make a (real, noticeable, measurable) difference for performance? Or is it not for performance but "style" - you don't want classes to be "open" and extensible by users? Thanks! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] vorburger commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
vorburger commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775574350 ## File path: log4j-to-jul/src/main/java/org/apache/logging/log4j/tojul/JULLogger.java ## @@ -0,0 +1,246 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.tojul; + +import static java.util.Objects.requireNonNull; + +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.spi.AbstractLogger; + +/** + * Implementation of {@link org.apache.logging.log4j.Logger} that's backed by a {@link Logger}. + * + * This implementation currently ignores {@link Marker}. + * + * @author http://www.vorburger.ch";>Michael Vorburger.ch for Google + */ +public class JULLogger extends AbstractLogger { +private static final long serialVersionUID = 1L; + +// @VisibleForTesting +final Logger logger; + +// This implementation is inspired by org.apache.logging.slf4j.SLF4JLogger + +public JULLogger(final String name, final MessageFactory messageFactory, final Logger logger) { +super(name, messageFactory); +this.logger = requireNonNull(logger, "logger"); +} + +public JULLogger(final String name, final Logger logger) { +super(name); +this.logger = requireNonNull(logger, "logger"); +} + +@Override +public void logMessage(final String fqcn, final Level level, final Marker marker, final Message message, final Throwable t) { +java.util.logging.Level julLevel = convertLevel(level); +if (!logger.isLoggable(julLevel)) { +return; +} +LogRecord record = new LogRecord(julLevel, message.getFormattedMessage()); // TODO getFormat() or getFormattedMessage() ? +record.setLoggerName(getName()); // TODO getName() or fqcn parameter? What's that? +record.setParameters(message.getParameters()); +record.setThrown(message.getThrowable()); Review comment: Oh sorry I misinterpreted - this is about using message's getThrowable() iff t is null! Please ignore my comment above. Either way, this is now applied. Thank You! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] vorburger commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
vorburger commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775572900 ## File path: log4j-to-jul/src/main/java/org/apache/logging/log4j/tojul/JULLogger.java ## @@ -0,0 +1,246 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache license, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the license for the specific language governing permissions and + * limitations under the license. + */ +package org.apache.logging.log4j.tojul; + +import static java.util.Objects.requireNonNull; + +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import org.apache.logging.log4j.Level; +import org.apache.logging.log4j.Marker; +import org.apache.logging.log4j.message.Message; +import org.apache.logging.log4j.message.MessageFactory; +import org.apache.logging.log4j.spi.AbstractLogger; + +/** + * Implementation of {@link org.apache.logging.log4j.Logger} that's backed by a {@link Logger}. + * + * This implementation currently ignores {@link Marker}. + * + * @author http://www.vorburger.ch";>Michael Vorburger.ch for Google + */ +public class JULLogger extends AbstractLogger { +private static final long serialVersionUID = 1L; + +// @VisibleForTesting +final Logger logger; + +// This implementation is inspired by org.apache.logging.slf4j.SLF4JLogger + +public JULLogger(final String name, final MessageFactory messageFactory, final Logger logger) { +super(name, messageFactory); +this.logger = requireNonNull(logger, "logger"); +} + +public JULLogger(final String name, final Logger logger) { +super(name); +this.logger = requireNonNull(logger, "logger"); +} + +@Override +public void logMessage(final String fqcn, final Level level, final Marker marker, final Message message, final Throwable t) { +java.util.logging.Level julLevel = convertLevel(level); +if (!logger.isLoggable(julLevel)) { +return; +} +LogRecord record = new LogRecord(julLevel, message.getFormattedMessage()); // TODO getFormat() or getFormattedMessage() ? +record.setLoggerName(getName()); // TODO getName() or fqcn parameter? What's that? +record.setParameters(message.getParameters()); +record.setThrown(message.getThrowable()); Review comment: `java.util.logging.LogRecord.setThrown(Throwable)` actually only does `this.thrown = thrown;` anyway, so this doesn't actually matter, but given that this has jumped out at you, let me commit your suggestion anyway, as it's clearer to read (to you). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] vorburger commented on a change in pull request #653: (DRAFT, WIP - DO NOT MERGE YET, BUT INITIAL REVIEW WELCOME) Release 2.x log4j-to-jul JDK Logging Bridge (LOG4J2-3282)
vorburger commented on a change in pull request #653: URL: https://github.com/apache/logging-log4j2/pull/653#discussion_r775528603 ## File path: pom.xml ## @@ -964,6 +964,19 @@ 0.8.1 test + +com.google.guava + +guava-testlib +31.0.1-jre +test + + +com.google.truth +truth +1.1.3 +test + Review comment: Ah, right. So I personally really like https://truth.dev and assumed it was a "more modern" alternative to https://assertj.github.io/doc/... but it seems like AssertJ may have "caught up" since I last had a closer look at it (years ago) and also has that "fluent style" that I like in Truth (only now, or always had?). There is an internal process at work that is a tiny bit easier for me if I can use Truth instead of AssertJ, so I have to ask 😸 if this feedback is a "suggestion" or a "requirement", for merge? I totally do understand if you make it a hard requirement, for consistency across Log4j, and am happy to switch and adapt, but I thought I would ask just to double check once before doing so. > I agree, it gives us a touch more flexibility. Which one, AssertJ or Truth? > OTOH, if a new class does not declare protected methods, does it matter? Sorry I did not understand this (my choice of assertion framework here wasn't related to testing declared protected methods). -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [logging-log4j2] garydgregory commented on pull request #667: Fix ExtendedLoggerWrapper.logMessage double-logging
garydgregory commented on pull request #667: URL: https://github.com/apache/logging-log4j2/pull/667#issuecomment-1001585742 Yikes, nice find @carterkozak 👍 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@logging.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[jira] [Commented] (LOG4J2-3291) while deploying spring application to weblogic server with version 2.17.0 giving ArrayIndexOutOfBoundsException
[ https://issues.apache.org/jira/browse/LOG4J2-3291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17465750#comment-17465750 ] Gary D. Gregory commented on LOG4J2-3291: - [~shahidlk] You've given us nothing to work with here. Please post a reproducible scenario or at the very least your stack trace and Log4j configuration file. Also, what version of WebLogic? > while deploying spring application to weblogic server with version 2.17.0 > giving ArrayIndexOutOfBoundsException > --- > > Key: LOG4J2-3291 > URL: https://issues.apache.org/jira/browse/LOG4J2-3291 > Project: Log4j 2 > Issue Type: Bug >Reporter: shahid shaikh >Priority: Major > -- This message was sent by Atlassian Jira (v8.20.1#820001)