Configuring logback

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Configuring logback

Vishwas Siravara
Hi guys,
I am using logback for my application logs. I have logback.xml as a part of my fat jar that I submit to flink via command line flink run "...". When I run my application from IDE , the appenders are what I have set in my logback but when I run from command line the appender defaults to the root in the flink installation directory. How can I make sure that my application logs go to the correct appender. Here is my logback.xml file which is available in the classpath. 

<?xml version="1.0" encoding="UTF-8"?>

<configuration debug="true">

<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>

<!-- To enable JMX Management -->
<jmxConfigurator />

<!-- Application Logger -->
<appender name="applogfile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${APP_LOG_ROOT}service.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${APP_LOG_ROOT}Archive/service.%d{yyyy-MM-dd_HH}.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} %p %c | %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="ASYNC_APPLOG" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>50000</queueSize>
<appender-ref ref="applogfile" />
</appender>
<logger name="com.visa.flink" level="INFO"
additivity="false">
<appender-ref ref="ASYNC_APPLOG" />
</logger>


<!-- Error Report Logger -->
<appender name="serviceerrorfile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${APP_LOG_ROOT}service-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${APP_LOG_ROOT}Archive/service-error.%d{yyyy-MM-dd_HH}.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} %p %c %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="ASYNC_STREAMING_ERROR" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>50000</queueSize>
<appender-ref ref="serviceerrorfile" />
</appender>
<logger name="streaming.error" level="ERROR" additivity="false">
<appender-ref ref="ASYNC_STREAMING_ERROR" />
</logger>



<!-- STDOUT -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} [%thread] %-5level %logger{5} -
%m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="STDOUT" />
</root>

</configuration>

Thanks,
Vishwas 

Reply | Threaded
Open this post in threaded view
|

Re: Configuring logback

RAMALINGESWARA RAO THOTTEMPUDI
Hi

How to build a Graph using Flink Gelly from a  text file that consists of edge list.

 regards
TR RAO


From: "Vishwas Siravara" <[hidden email]>
To: "user" <[hidden email]>
Sent: Tuesday, August 20, 2019 9:17:01 PM
Subject: Configuring logback

Hi guys,
I am using logback for my application logs. I have logback.xml as a part of my fat jar that I submit to flink via command line flink run "...". When I run my application from IDE , the appenders are what I have set in my logback but when I run from command line the appender defaults to the root in the flink installation directory. How can I make sure that my application logs go to the correct appender. Here is my logback.xml file which is available in the classpath. 

<?xml version="1.0" encoding="UTF-8"?>

<configuration debug="true">

<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>

<!-- To enable JMX Management -->
<jmxConfigurator />

<!-- Application Logger -->
<appender name="applogfile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${APP_LOG_ROOT}service.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${APP_LOG_ROOT}Archive/service.%d{yyyy-MM-dd_HH}.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} %p %c | %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="ASYNC_APPLOG" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>50000</queueSize>
<appender-ref ref="applogfile" />
</appender>
<logger name="com.visa.flink" level="INFO"
additivity="false">
<appender-ref ref="ASYNC_APPLOG" />
</logger>


<!-- Error Report Logger -->
<appender name="serviceerrorfile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${APP_LOG_ROOT}service-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${APP_LOG_ROOT}Archive/service-error.%d{yyyy-MM-dd_HH}.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} %p %c %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="ASYNC_STREAMING_ERROR" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>50000</queueSize>
<appender-ref ref="serviceerrorfile" />
</appender>
<logger name="streaming.error" level="ERROR" additivity="false">
<appender-ref ref="ASYNC_STREAMING_ERROR" />
</logger>



<!-- STDOUT -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} [%thread] %-5level %logger{5} -
%m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="STDOUT" />
</root>

</configuration>

Thanks,
Vishwas 

Reply | Threaded
Open this post in threaded view
|

Running flink example programs-WordCount

RAMALINGESWARA RAO THOTTEMPUDI
Hi,
I am using the command

" ./bin/flink run ./examples/batch/WordCount.jar --input /home/trrao/Desktop/ram2.txt --output /home/trrao/Desktop/ramop.txt "

But I am getting  " Caused by: java.net.ConnectException:connection refused"

Kindly give the correct to run the wordcount example in flink batch examples.

regards
TR RAO

From: "RAMALINGESWARA RAO THOTTEMPUDI" <[hidden email]>
To: "Vishwas Siravara" <[hidden email]>
Cc: "user" <[hidden email]>
Sent: Tuesday, August 20, 2019 9:51:09 PM
Subject: Re: Configuring logback

Hi

How to build a Graph using Flink Gelly from a  text file that consists of edge list.

 regards
TR RAO


From: "Vishwas Siravara" <[hidden email]>
To: "user" <[hidden email]>
Sent: Tuesday, August 20, 2019 9:17:01 PM
Subject: Configuring logback

Hi guys,
I am using logback for my application logs. I have logback.xml as a part of my fat jar that I submit to flink via command line flink run "...". When I run my application from IDE , the appenders are what I have set in my logback but when I run from command line the appender defaults to the root in the flink installation directory. How can I make sure that my application logs go to the correct appender. Here is my logback.xml file which is available in the classpath. 

<?xml version="1.0" encoding="UTF-8"?>

<configuration debug="true">

<contextListener class="ch.qos.logback.classic.jul.LevelChangePropagator">
<resetJUL>true</resetJUL>
</contextListener>

<!-- To enable JMX Management -->
<jmxConfigurator />

<!-- Application Logger -->
<appender name="applogfile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${APP_LOG_ROOT}service.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${APP_LOG_ROOT}Archive/service.%d{yyyy-MM-dd_HH}.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} %p %c | %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="ASYNC_APPLOG" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>50000</queueSize>
<appender-ref ref="applogfile" />
</appender>
<logger name="com.visa.flink" level="INFO"
additivity="false">
<appender-ref ref="ASYNC_APPLOG" />
</logger>


<!-- Error Report Logger -->
<appender name="serviceerrorfile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<file>${APP_LOG_ROOT}service-error.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${APP_LOG_ROOT}Archive/service-error.%d{yyyy-MM-dd_HH}.log.gz</fileNamePattern>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} %p %c %m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="ASYNC_STREAMING_ERROR" class="ch.qos.logback.classic.AsyncAppender">
<discardingThreshold>0</discardingThreshold>
<queueSize>50000</queueSize>
<appender-ref ref="serviceerrorfile" />
</appender>
<logger name="streaming.error" level="ERROR" additivity="false">
<appender-ref ref="ASYNC_STREAMING_ERROR" />
</logger>



<!-- STDOUT -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} [%thread] %-5level %logger{5} -
%m%n</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>

<root level="INFO">
<appender-ref ref="STDOUT" />
</root>

</configuration>

Thanks,
Vishwas