agido-malter / logback-elasticsearch-appender

Logback Elasticsearch Appender
Other
23 stars 11 forks source link

Problem with logback 1.3.0 #11

Closed akoshman closed 1 year ago

akoshman commented 1 year ago

Hello, I'm facing the problem with logback 1.3.0 onwards. Properties are not being configured and just ignored:

        <properties>
            <property>
                <name>host</name>
                <value>${HOSTNAME}</value>
                <allowEmpty>false</allowEmpty>
            </property>
            <property>
                <name>severity</name>
                <value>%level</value>
            </property>
            <property>
                <name>thread</name>
                <value>%thread</value>
            </property>
            <property>
                <name>stacktrace</name>
                <value>%ex</value>
            </property>
            <property>
                <name>logger</name>
                <value>%logger</value>
            </property>
        </properties>

With logback 1.2.11 it workds well. Does anyone have this problem?

akoshman commented 1 year ago

debug info from logback 1.2.11:

0:35:05,454 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
00:35:05,454 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/test-logback/my-app/target/classes/logback.xml]
00:35:05,571 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [com.agido.logback.elasticsearch.ElasticsearchAppender]
00:35:05,576 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [elastic]
00:35:05,588 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [com.agido.logback.elasticsearch.config.ElasticsearchProperties] for [properties] property
00:35:05,590 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [com.agido.logback.elasticsearch.config.Property] for [property] property
00:35:05,590 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [com.agido.logback.elasticsearch.config.Property] for [property] property
00:35:05,591 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [com.agido.logback.elasticsearch.config.HttpRequestHeaders] for [headers] property
00:35:05,591 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [com.agido.logback.elasticsearch.config.HttpRequestHeader] for [header] property
00:35:05,630 |-ERROR in ch.qos.logback.classic.PatternLayout("null") - Empty or null pattern.
00:35:05,630 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN
00:35:05,630 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [elastic] to Logger[ROOT]
00:35:05,631 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
00:35:05,632 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [console]
00:35:05,634 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
00:35:05,638 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.classic.AsyncAppender]
00:35:05,639 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [async-console]
00:35:05,640 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [console] to ch.qos.logback.classic.AsyncAppender[async-console]
00:35:05,640 |-INFO in ch.qos.logback.classic.AsyncAppender[async-console] - Attaching appender named [console] to AsyncAppender.
00:35:05,640 |-INFO in ch.qos.logback.classic.AsyncAppender[async-console] - Setting discardingThreshold to 51
00:35:05,641 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO
00:35:05,641 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [async-console] to Logger[ROOT]
00:35:05,641 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
00:35:05,642 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@7276c8cd - Registering current configuration as safe fallback point
Hello World!
2023-02-01 00:35:05 ERROR main App:main:14 - TEST TEST TEST;
Disconnected from the target VM, address: '127.0.0.1:56204', transport: 'socket'

Process finished with exit code 130

debug from logback 1.3.5:

00:38:54,500 |-INFO in ch.qos.logback.classic.LoggerContext[default] - This is logback-classic version 1.3.5
00:38:54,519 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml]
00:38:54,520 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [file:/C:/test-logback/my-app/target/classes/logback.xml]
00:38:54,656 |-INFO in ch.qos.logback.classic.model.processor.ConfigurationModelHandler - Registering a new ReconfigureOnChangeTask ReconfigureOnChangeTask(born:1675204734656)
00:38:54,656 |-INFO in ch.qos.logback.classic.model.processor.ConfigurationModelHandler - No 'scanPeriod' specified. Defaulting to 1 minutes
00:38:54,656 |-INFO in ch.qos.logback.classic.model.processor.ConfigurationModelHandler - Will scan for changes in [file:/C:/test-logback/my-app/target/classes/logback.xml] 
00:38:54,656 |-INFO in ch.qos.logback.classic.model.processor.ConfigurationModelHandler - Setting ReconfigureOnChangeTask scanning period to 1 minutes
00:38:54,658 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [elastic]
00:38:54,659 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [com.agido.logback.elasticsearch.ElasticsearchAppender]
00:38:54,670 |-INFO in ch.qos.logback.core.model.processor.ImplicitModelHandler - Assuming default type [com.agido.logback.elasticsearch.config.ElasticsearchProperties] for [properties] property
00:38:54,677 |-WARN in ch.qos.logback.core.model.processor.ImplicitModelHandler - Ignoring unknown property [name] in [com.agido.logback.elasticsearch.config.ElasticsearchProperties]
00:38:54,678 |-WARN in ch.qos.logback.core.model.processor.ImplicitModelHandler - Ignoring unknown property [value] in [com.agido.logback.elasticsearch.config.ElasticsearchProperties]
00:38:54,678 |-INFO in ch.qos.logback.core.model.processor.ImplicitModelHandler - Assuming default type [com.agido.logback.elasticsearch.config.HttpRequestHeaders] for [headers] property
00:38:54,678 |-INFO in ch.qos.logback.core.model.processor.ImplicitModelHandler - Assuming default type [com.agido.logback.elasticsearch.config.HttpRequestHeader] for [header] property
00:38:54,714 |-INFO in ch.qos.logback.classic.model.processor.RootLoggerModelHandler - Setting level of ROOT logger to WARN
00:38:54,714 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [elastic] to Logger[ROOT]
00:38:54,714 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [console]
00:38:54,714 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
00:38:54,716 |-INFO in ch.qos.logback.core.model.processor.ImplicitModelHandler - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
00:38:54,719 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - Processing appender named [async-console]
00:38:54,719 |-INFO in ch.qos.logback.core.model.processor.AppenderModelHandler - About to instantiate appender of type [ch.qos.logback.classic.AsyncAppender]
00:38:54,720 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [console] to ch.qos.logback.classic.AsyncAppender[async-console]
00:38:54,720 |-INFO in ch.qos.logback.classic.AsyncAppender[async-console] - Attaching appender named [console] to AsyncAppender.
00:38:54,721 |-INFO in ch.qos.logback.classic.AsyncAppender[async-console] - Setting discardingThreshold to 51
00:38:54,721 |-INFO in ch.qos.logback.classic.model.processor.RootLoggerModelHandler - Setting level of ROOT logger to INFO
00:38:54,721 |-INFO in ch.qos.logback.core.model.processor.AppenderRefModelHandler - Attaching appender named [async-console] to Logger[ROOT]
00:38:54,722 |-INFO in ch.qos.logback.core.model.processor.DefaultProcessor@78047b92 - End of configuration.
00:38:54,722 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@4387b79e - Registering current configuration as safe fallback point

it just ignores properties tags like "name" and "value"

agido-jrieks commented 1 year ago

@akoshman fixed in 3.0.6, will be released today (there is currently a problem with the upstream nexus)

please use <esProperty> instead of <property> for logback-1.3