Login IP remote in the logs Log4J

  • Thread starter Miguelon cosapi data
  • Start date
M

Miguelon cosapi data

Hello friends, I hope can help me with the following thing: I have an
application that uses the "Log4J", which I want to know is that
line I must add so that also it registers the IP address of the clients
who accede to this aplicaion. At the moment this recording date and URL
but I need remote IP address. thanks
 
M

Miguelon cosapi data

Hello Paul
The application is "Critical Path" and is a Mail server in the Linux
with Webmail, calendar, etc. this is based on a called file
"log-conf.xml" that this in the format "Log4j" the information
that registers to me is the following:

2006-11-16 11:36:53,851 - sid[1163694663376]
thread[http-443-Processor86] dir[0/0, 0, 0, 0] time[62]
url[/cp/ps/Mail/ViewMsgController?d=congreso.gob.pe&u=fondoeditorial&an=DefaultMailAccount&t=d104d&l=es&fp=INBOX&uid=98]
2006-11-16 11:37:11,283 - sid[1163694663376]
thread[http-443-Processor13] dir[0/0, 0, 0, 0] time[157]
url[/cp/ps/Mail/ViewMsgController?d=congreso.gob.pe&bid=null_0&u=fondoeditorial&t=d104d&l=es&siz=38278]
2006-11-16 11:37:27,892 - sid[1163695047890]
thread[http-443-Processor85] dir[0/0, 0, 0, 0] time[4]
url[/cp/ps/Main/login/Login?d=congreso.gob.pe&l=es]
2006-11-16 11:37:34,478 - sid[1163695047890]
thread[http-443-Processor13] dir[1/5, 0, 1, 0] time[4]
url[/cp/ps/Main/layout/MetaFrameset?d=congreso.gob.pe&u=emendez&t=d10d5&l=es]

what I need is that additional to that information IP address of the
client is added who connects itself to the server.

the configuration of "log-conf.xml" is the following:

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

<!--
- Logging configuration; see the Log4J docs and log4j.dtd for
details
- of this file's format and content.
-->

<!--
The following log levels are supported, they are listed in
order of precedence:

Disable - DISABLE
Emergency - EMERGENCY
Alert - ALERT
Critical - CRITICAL
Fatal - FATAL
Error - ERROR
Warning - WARN
Notice - NOTICE
Information - INFO
Debug - DEBUG
All - ALL
-->

<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">

<log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'>

<!--
====================================================================
Appender declarations -->

<!-- Presentation Server log appender -->
<appender name="ps-log"
class="net.cp.ps.sdk.util.log.RollingFileAppender">
<param name="File" value="WEB-INF/log-files/server.log"/>
<param name="MaxFileSize" value="1MB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %c{1} - %m%n"/>
</layout>
</appender>
<!-- Presentation Server Access log appender -->
<appender name="access-log"
class="net.cp.ps.sdk.util.log.RollingFileAppender">
<param name="File" value="WEB-INF/log-files/access.log"/>

<param name="MaxFileSize" value="100MB"/>
<param name="MaxBackupIndex" value="20"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d - %m%n"/>
</layout>
</appender>

<!-- Presentation Server Slow Request log appender -->
<appender name="slow-log"
class="net.cp.ps.sdk.util.log.RollingFileAppender">
<param name="File" value="WEB-INF/log-files/slow.log"/>
<param name="MaxFileSize" value="1MB"/>
<param name="MaxBackupIndex" value="20"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p - %m%n"/>
</layout>
</appender>

<!-- Downloader appender. -->
<appender name="downloader-log"
class="net.cp.ps.sdk.util.log.RollingFileAppender">
<param name="File" value="WEB-INF/log-files/downloader.log"/>
<param name="MaxFileSize" value="1MB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %c{1} - %m%n"/>
</layout>
</appender>

<!-- Begin Fix 39570 -->
<!-- Mail appender -->
<appender name="mail-log"
class="net.cp.ps.sdk.util.log.RollingFileAppender">
<param name="File" value="WEB-INF/log-files/mail.log" />
<param name="MaxFileSize" value="1MB" />
<param name="MaxBackupIndex" value="1" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %c{1} -%m%n"
/>
</layout>
</appender>

<!-- End Fix 39570 -->

<appender name="cal-log"
class="net.cp.ps.sdk.util.log.RollingFileAppender">
<param name="File" value="WEB-INF/log-files/cal.log"/>
<param name="MaxFileSize" value="1MB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p
%c{1} - %m%n"/>
</layout>
</appender>
<appender name="pab-log"
class="net.cp.ps.sdk.util.log.RollingFileAppender">
<param name="File" value="WEB-INF/log-files/pab.log"/>
<param name="MaxFileSize" value="1MB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p
%c{1} - %m%n"/>
</layout>
</appender>
<appender name="ac-log"
class="net.cp.ps.sdk.util.log.RollingFileAppender">
<param name="File" value="WEB-INF/log-files/ac.log"/>
<param name="MaxFileSize" value="1MB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p
%c{1} - %m%n"/>
</layout>
</appender>
<!-- Log appender for everything not otherwise directed -->
<appender name="sys-log"
class="net.cp.ps.sdk.util.log.RollingFileAppender">
<param name="File" value="WEB-INF/log-files/system.log"/>
<param name="MaxFileSize" value="1MB"/>
<param name="MaxBackupIndex" value="1"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p %c - %m%n"/>
</layout>
</appender>

<!--
====================================================================
Attach appenders to appropriate categories -->

<!-- Presentation Server -->

<category name="net.cp.ps.sdk" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info"/>
<appender-ref ref="ps-log"/>
</category>

<category name="net.cp.ps.log.Access" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info"/>
<appender-ref ref="access-log"/>
</category>

<category name="net.cp.ps.sdk.tools.monitor.request.RequestWatcher"
additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info"/>
<appender-ref ref="slow-log"/>
</category>

<category name="net.cp.ps.sdk.downloader" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info"/>
<appender-ref ref="downloader-log"/>
</category>

<category name="net.cp.ps.main" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info"/>
<appender-ref ref="ps-log"/>
</category>

<category name="net.cp.ps.uikit" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info"/>
<appender-ref ref="ps-log"/>
</category>

<category name="net.cp.ps.provision" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info"/>
<appender-ref ref="ps-log"/>
</category>

<!-- Begin Fix 39570 -->
<category name="net.cp.ps.mail" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info"
/>
<appender-ref ref="mail-log" />
</category>
<!-- End Fix 39570 -->

<!-- Supress verbose debug output from Settings class. -->
<category name="net.cp.ps.sdk.settings.Settings">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info" />
</category>

<!-- Supress verbose debug output from TimerDirContext class. -->
<category name="net.cp.ps.sdk.util.jndi.timer.TimerDirContext">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info" />
</category>

<!-- Ensure that unhandled exception error reporting is left on -->
<category name="net.cp.ps.sdk.http.JSPProcessor">
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="error"/>
</category>

<!-- Catch-all: any logging from unmapped categories -->

<root>
<priority class="net.cp.ps.sdk.util.log.LogLevel" value="info" />
<appender-ref ref="sys-log" />
</root>

<category name="net.cp.ps.calendar" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel"
value="info"/>
<appender-ref ref="cal-log"/>
</category>


<category name="net.jlibical" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel"
value="info"/>
<appender-ref ref="cal-log"/>
</category>
<category name="net.cp.ps.pspab" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel"
value="info"/>
<appender-ref ref="pab-log"/>
</category>


<category name="net.cp.client.pab" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel"
value="info"/>
<appender-ref ref="pab-log"/>
</category>

<category name="net.cp.client.pspab" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel"
value="info"/>
<appender-ref ref="pab-log"/>
</category>

<category name="net.cp.ps.directory" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel"
value="info"/>
<appender-ref ref="pab-log"/>
</category>
<category name="net.cp.ps.ac" additivity="false">
<priority class="net.cp.ps.sdk.util.log.LogLevel"
value="info"/>
<appender-ref ref="ac-log"/>
</category>
</log4j:configuration>


The file for login acces is: WEB-INF/log-files/access.log

thanks.

Paul Lutus ha escrito:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top