Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-settings.php on line 399

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-settings.php on line 414

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-settings.php on line 421

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-settings.php on line 456

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 593

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 710

Strict Standards: Redefining already defined constructor for class wpdb in /home/mangar.com.br/blogv3/wp-includes/wp-db.php on line 58

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-includes/cache.php on line 99

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/mangar.com.br/blogv3/wp-includes/cache.php on line 404

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-includes/theme.php on line 576

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method Add_to_Any_Subscribe_Widget::init() should not be called statically in /home/mangar.com.br/blogv3/wp-includes/plugin.php on line 311

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GoogleSitemapGeneratorLoader::Enable() should not be called statically in /home/mangar.com.br/blogv3/wp-includes/plugin.php on line 311

Deprecated: Function eregi() is deprecated in /home/mangar.com.br/blogv3/wp-content/plugins/wp-statpress/statpress.php on line 1139

Deprecated: Function eregi() is deprecated in /home/mangar.com.br/blogv3/wp-content/plugins/wp-statpress/statpress.php on line 1140

Deprecated: Function eregi() is deprecated in /home/mangar.com.br/blogv3/wp-content/plugins/wp-statpress/statpress.php on line 1141

Deprecated: Function eregi() is deprecated in /home/mangar.com.br/blogv3/wp-content/plugins/wp-statpress/statpress.php on line 1142

Deprecated: Function ereg() is deprecated in /home/mangar.com.br/blogv3/wp-content/plugins/wp-statpress/statpress.php on line 979
Log4J at Marcio Garcia

Marcio Garcia

Software Empowerment²

Archive for the ‘Log4J’ tag

Log4J - log diferente para classes diferentes…

without comments

Algumas vezes é interessante criar arquivos de log distintos para a mesma aplicação, por exemplo: módulos diferentes, front-end e back-end…..

O Log4J é uma lib muito flexível quanto a isso, vejamos as configurações necessários no log4j.properties :

  • Configuração inicial
 # Configuração dos logs
log4j.rootLogger=DEBUG, defualtconfig
log4j.logger.br.com.mangar.app01.module01=DEBUG, module1log
log4j.logger.br.com.mangar.app01.module02=DEBUG, module2log
#
log4j.additivity.br.com.mangar.app01.module01=false
log4j.additivity.br.com.mangar.app01.module02=false

  • Appender geral, para todas as classes:
 # Appender geral
log4j.appender.defaultconfig=org.apache.log4j.DailyRollingFileAppender
log4j.appender.fileglobal.File=${app01_home}\log\app01-geral.log
log4j.appender.fileglobal.DatePattern='.'dd-mm-yyyy
log4j.appender.fileglobal.layout=org.apache.log4j.PatternLayout
log4j.appender.fileglobal.layout.ConversionPattern=%5p %d{dd MMM HH:mm:ss} [%t] %c - %m%n

  • Appender para o Módulo 1
 # Appender para o Módulo 1
log4j.appender.fileconpool=org.apache.log4j.DailyRollingFileAppender
log4j.appender.fileconpool.File=${app_home}\log\app01-module01.log
log4j.appender.fileconpool.DatePattern='.'dd-MM-yyyy
log4j.appender.fileconpool.layout=org.apache.log4j.PatternLayout
log4j.appender.fileconpool.layout.ConversionPattern=%5p %d{dd MMM HH:mm:ss} [%t] %c - %m%n 

  • Appender para o Módulo 2
 # Appender para o Modulo 2
log4j.appender.filexptolog=org.apache.log4j.DailyRollingFileAppender
log4j.appender.filexptolog.File=${app_home}\log\app01-module02.log
log4j.appender.filexptolog.DatePattern='.'dd-MM-yyyy
log4j.appender.filexptolog.layout=org.apache.log4j.PatternLayout
log4j.appender.filexptolog.layout.ConversionPattern=%5p %d{dd MMM HH:mm:ss} [%t] %c - %m%n

Written by Marcio

October 28th, 2007 at 3:00 pm

Posted in Log4J

Tagged with

Log4J - log diário

without comments

Muito útil (e muito simples) de ser configurado, é muito útil principalmente em ambientes de produção, onde os logs serão utilizados para análise e futuras correções de problemas na aplicação.

O mecanismos é o seguinte: o log é gerado em um arquivo durante todo o dia, pode exemplo: app.log, quando o dia é mudado, à 00:00:00 o próximo evento de log, fará com que o arquivo atual (app.log) seja renomeado para o padrão definido na configuração do log, por exemplo: app-dd-mm-yyyy.log e um novo arquivo de log será gerado com o nome de app.log.
# log4j.appender.fileglobal=org.apache.log4j.DailyRollingFileAppender
# log4j.appender.fileglobal.File=${app_home}/log/app.log
# log4j.appender.fileglobal.DatePattern='.'yyyy-MM-dd
# log4j.appender.fileglobal.layout=org.apache.log4j.PatternLayout
# log4j.appender.fileglobal.layout.ConversionPattern=%5p %d{dd MMM HH:mm:ss} [%t] %c - %m%n
>

${app_home} é uma variável de ambiente apontando para o diretorio home da App.

Written by Marcio

October 28th, 2007 at 2:44 pm

Posted in Log4J

Tagged with