Giter VIP home page Giter VIP logo

Comments (6)

ppkarwasz avatar ppkarwasz commented on August 15, 2024 1

@linghengqian,

The problem is due to a typo in your configuration file:

logger.CBORuleLogger.filter.marker.type = MarkerFilter
logger.CBORuleLogger.filter.marker.marker = FULL_PLAN
logger.CBORuleLogger.filter.marker.onMatch = DENY
logger.CBORuleLogger.filter.marker.onMisMatch = NEUTRAL

You have onMisMatch instead of onMismatch. The misleading error message is due to the following code in PropertiesConfigurationBuilder:

final String onMatch = (String) properties.remove(AbstractFilterBuilder.ATTR_ON_MATCH);
final String onMismatch = (String) properties.remove(AbstractFilterBuilder.ATTR_ON_MISMATCH);
final FilterComponentBuilder filterBuilder = builder.newFilter(type, onMatch, onMismatch);

@Override
public FilterComponentBuilder newFilter(final String type, final String onMatch, final String onMismatch) {
return new DefaultFilterComponentBuilder(this, type, onMatch, onMismatch);
}

public DefaultFilterComponentBuilder(
final DefaultConfigurationBuilder<? extends Configuration> builder,
final String type,
final String onMatch,
final String onMismatch) {
super(builder, type);
addAttribute(AbstractFilterBuilder.ATTR_ON_MATCH, onMatch);
addAttribute(AbstractFilterBuilder.ATTR_ON_MISMATCH, onMismatch);
}

Since you don't have an onMismatch attribute, the code creates a synthetic onMismatch attribute with an invalid null value.

Remark: Fixing this also fixes LOG4J2-2931, so I am redirecting that issue here.

PS: I noticed that Apache Hive uses a pre-2.6 properties configuration format (the loggers is not required since version 2.6).
Would you consider switching to a more easily readable configuration format? Version 3.x will introduce breaking changes to the properties format, but not the hierarchical ones.

from logging-log4j2.

ppkarwasz avatar ppkarwasz commented on August 15, 2024 1

@ppkarwasz

I note from https://issues.apache.org/jira/browse/LOG4J2-3644 that the packages property seems to be straightforward to remove, though Migrate log4j2 to logback jmeter#5937 on the apache/jmeter side is still unclear as to the way forward.

There is no problem in Apache Hive: I checked that the appropriate annotation processor is configured in the hive-exec project and there is a Log4j2Plugins.dat file in the JAR. You can safely remove the packages configuration attribute.

* I will say that I personally don't know how to fix [Fix handling of `onMatch` and `onMismatch` attributes in the properties configuration format #2791](https://github.com/apache/logging-log4j2/issues/2791) with the `good first issue` tag.

I believe that the problem breaks down to a missing null-check: ComponentBuilder#addAttribute should add an attribute if the value is not null and remove it if the value is null.

null is never a valid value for an attribute.

BTW: All the problems you are having are due to the fact that TestHplsqlLocal and TestHplsqlOffline are fragile tests. They write something to System.out and they make assertions about that. The problem is: other components (like the status logger) might also write to System.out. I proposed a solution to this in apache/hive#5381

from logging-log4j2.

ppkarwasz avatar ppkarwasz commented on August 15, 2024

Hi @linghengqian,

Could you point us to how you generate the GraalVM image?

As almost all filters (except DenyAllFilter and Filters), MarkerFilter has a onMismatch property. I suspect that the GraalVM reflection metadata you use might lack the property, hence the problem in the native image.

from logging-log4j2.

linghengqian avatar linghengqian commented on August 15, 2024

Hi @linghengqian,

Could you point us to how you generate the GraalVM image?

As almost all filters (except DenyAllFilter and Filters), MarkerFilter has a onMismatch property. I suspect that the GraalVM reflection metadata you use might lack the property, hence the problem in the native image.

  • Hi, the steps I mentioned in the issue description never involve using log4j2 under GraalVM Native Image. I assume you are referring to apache/shardingsphere#31526 . On the shardingspehre side, all nativeTest under GraalVM Native Image have excluded log4j2 in maven pom, and I am actually waiting for the release of log4j2 2.24.0.

  • On the hive side, the Error Log of ERROR MarkerFilter contains an invalid element or attribute "onMismatch" is obtained by executing unit tests under Hotspot JDK 8. Hive can still only be compiled with openjdk 8, and it is too early to discuss graalvm native image in the hive community.

from logging-log4j2.

linghengqian avatar linghengqian commented on August 15, 2024

@ppkarwasz

  • Late reply, because I need to wait for verification on apache/hive's CI side. apache/hive's CI resources are too tight, and apache/hive's jenkins node limits each contributor to 5 hours between 2 consecutive CIs. To be honest, apache/hive#5375 is the first PR I opened on apache/hive's side, and I know almost nothing about apache/hive's logging design.

  • I updated apache/hive#5375 not long ago, I removed the packages, appenders, loggers nodes of /hive/data/conf/hive-log4j2.properties, and changed logger.CBORuleLogger.filter.marker.onMisMatch to logger.CBORuleLogger.filter.marker.onMismatch. apache/hive's CI is now back on apache/logging-log4j2:2.23.0. I'm assuming this is a reasonable way forward to not break compatibility with future versions of log4j2. I'm assuming the changes are in line with what's documented in apache/pulsar#22327 , https://logging.apache.org/log4j/2.x/manual/configuration.html , and https://logging.apache.org/log4j/2.x/manual/plugins.html . I note from https://issues.apache.org/jira/browse/LOG4J2-3644 that the packages property seems to be straightforward to remove, though apache/jmeter#5937 on the apache/jmeter side is still unclear as to the way forward.

2024-08-02T10:55:16.634Z main WARN The use of package scanning to locate plugins is deprecated and will be removed in a future release
2024-08-02T10:55:16.650Z main WARN The use of package scanning to locate plugins is deprecated and will be removed in a future release
2024-08-02T10:55:16.670Z main WARN The use of package scanning to locate plugins is deprecated and will be removed in a future release
2024-08-02T10:55:16.686Z main WARN The use of package scanning to locate plugins is deprecated and will be removed in a future release
  • On the apache/hive side, I noticed a new issue when bump from apache/logging-log4j2:2.23.0 to apache/logging-log4j2:2.23.1, the status = INFO defined in hive-log4j2.properties is no longer valid, and Log4j2 internal logs at TRACE and DEBUG levels will be printed starting from apache/logging-log4j2:2.23.1. Since the current issue is bound to https://issues.apache.org/jira/browse/LOG4J2-2931 , I opened #2794 to avoid ambiguity.

  • I will say that I personally don't know how to fix #2791 with the good first issue tag.

from logging-log4j2.

linghengqian avatar linghengqian commented on August 15, 2024

Hi @linghengqian,

Could you point us to how you generate the GraalVM image?

As almost all filters (except DenyAllFilter and Filters), MarkerFilter has a onMismatch property. I suspect that the GraalVM reflection metadata you use might lack the property, hence the problem in the native image.

  • As an external update, I have provided a partial GRM for log4j2 at #1539 (comment) .

from logging-log4j2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.