Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Login IP remote in the logs Log4J

Reply
Thread Tools

Login IP remote in the logs Log4J

 
 
Miguelon cosapi data
Guest
Posts: n/a
 
      11-28-2006
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

 
Reply With Quote
 
 
 
 
Miguelon cosapi data
Guest
Posts: n/a
 
      11-28-2006
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=fondoeditori al&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=f ondoeditorial&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.RequestW atcher"
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.TimerDirContex t">
<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:

> Miguelon cosapi data wrote:
>
> > 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.

>
> The answer depends on information not provided. What kind of application is
> it? What does it do?
>
> --
> Paul Lutus
> http://www.arachnoid.com


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Log4j configuration: how to suppress internal logs from Log4j? joes Java 1 08-06-2005 04:31 PM
WinXP Home SP2 logs in then right away logs off Andrew Computer Support 15 10-19-2004 09:45 AM
Win XP SP2 Logs in then Logs out awallwork at sign gmail dot com Computer Support 2 10-16-2004 08:19 PM
Win XP SP2 Logs in then Logs out Andrew Computer Support 2 10-16-2004 04:27 PM
WinXP Home SP2 Logs on then Logs off awallwork at sign gmail dot com Computer Support 2 10-16-2004 02:28 AM



Advertisments