logzio / logzio-logback-appender

Logback Appender that ships logs using HTTPs bulk
Apache License 2.0
25 stars 19 forks source link

Azure function failed to log #61

Open maksym-synkevych opened 5 years ago

maksym-synkevych commented 5 years ago

Filed to log java-based Azure function using logback appender. Logging works properly when I'm running the application locally, but failed when trying to run it on Azure Function App environment with the following error:

2019-10-11T11:09:03.943 [Information] java.lang.IllegalStateException: Logback configuration error detected:
2019-10-11T11:09:03.943 [Information] ERROR in ch.qos.logback.core.joran.spi.Interpreter@14:16 - RuntimeException in Action for tag [appender] java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@4af18225 rejected from java.util.concurrent.ScheduledThreadPoolExecutor@5283b3c5[Shutting down, pool size = 3, active threads = 0, queued tasks = 0, completed tasks = 2]

Full stacktrace available in here logzio-appender.log. Here is my configuration (real token replaced by "token" world):

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
    <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
    <shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
    <appender name="LOGZIO" class="io.logz.logback.LogzioLogbackAppender">
        <token>token</token>
        <logzioUrl>https://listener-nl.logz.io:8071</logzioUrl>
        <logzioType>azure-function</logzioType>
    </appender>
    <root level="DEBUG">
        <appender-ref ref="CONSOLE"/>
        <appender-ref ref="LOGZIO"/>
    </root>
    <logger name="org.springframework.web" level="DEBUG"/>
</configuration>
idohalevi commented 5 years ago

@maksym-synkevych It looks like the error is related to the logging fw. Can you try it with the console appender only and tell me if you have an issue or not?

maksym-synkevych commented 5 years ago

@idohalevi Tried with only console appender (by commenting it) and it is also failed with following configuration.

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
    <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
    <shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
    <appender name="LOGZIO" class="io.logz.logback.LogzioLogbackAppender">
        <token>token</token>
        <logzioUrl>https://listener-nl.logz.io:8071</logzioUrl>
        <logzioType>azure-function</logzioType>
    </appender>
    <root level="DEBUG">
        <appender-ref ref="CONSOLE"/>
    <!--    <appender-ref ref="LOGZIO"/>-->
    </root>
    <logger name="org.springframework.web" level="DEBUG"/>
</configuration>

But console logging works properly if I completely remove logzio configuration:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <include resource="org/springframework/boot/logging/logback/defaults.xml"/>
    <include resource="org/springframework/boot/logging/logback/console-appender.xml"/>
    <root level="DEBUG">
        <appender-ref ref="CONSOLE"/>
    </root>
    <logger name="org.springframework.web" level="DEBUG"/>
</configuration>
idohalevi commented 5 years ago

@maksym-synkevych Please remove the token from the configuration sample. Can you provide the logs for the error?

maksym-synkevych commented 5 years ago

@idohalevi Updated previous message by removing the token. You can see logs in attachments. logzio-appender.log

idohalevi commented 5 years ago

@maksym-synkevych Can you add the versions of the logback & logz.io appender? In addition, can you sure a snapshot of the project structure, specifically where is your logback.xml configuration and the naming of the files?

maksym-synkevych commented 5 years ago

@idohalevi The version of logzio appender is 1.0.22 The project structure is following image

idohalevi commented 5 years ago

@maksym-synkevych Can you try the fix here? rename logback.xml to logback-spring.xml

maksym-synkevych commented 5 years ago

@idohalevi Still failing with the same error:

2019-10-29T13:52:49.854 [Information] 2019-10-29 13:52:49.837 ERROR 9124 --- [pool-2-thread-2] o.s.boot.SpringApplication               : Application run failed
2019-10-29T13:52:49.854 [Information] java.lang.IllegalStateException: Logback configuration error detected:
2019-10-29T13:52:49.854 [Information] ERROR in ch.qos.logback.core.joran.spi.Interpreter@10:16 - RuntimeException in Action for tag [appender] java.util.concurrent.RejectedExecutionException: Task java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask@62b08a6e rejected from java.util.concurrent.ScheduledThreadPoolExecutor@5a59fc85[Shutting down, pool size = 6, active threads = 0, queued tasks = 0, completed tasks = 3]
2019-10-29T13:52:49.854 [Information] at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:166)
2019-10-29T13:52:49.854 [Information] at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:79)
2019-10-29T13:52:49.854 [Information] at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:59)
2019-10-29T13:52:49.855 [Information] at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:117)
2019-10-29T13:52:49.855 [Information] at org.springframework.boot.context.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:279)
2019-10-29T13:52:49.855 [Information] at org.springframework.boot.context.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:254)