users@glassfish.java.net

RE: Q: Is there a way I can log access to the glassfish server?

From: Martin Gainty <mgainty_at_hotmail.com>
Date: Thu, 17 Dec 2009 18:13:06 -0500

change the uniformLogFormat method in UniformLogFormatter and compile

http://www.javadocexamples.com/java_source/com/sun/enterprise/server/logging/UniformLogFormatter.java.html
/**
 249: * Note: This method is not synchronized, we are assuming that the
 250: * synchronization will happen at the Log Handler.publish( ) method.
 251: */
 252:... private String uniformLogFormat(LogRecord record) {
 253:
 254:... try {
 255:
 256: StringBuilder recordBuffer = new StringBuilder(RECORD_BEGIN_MARKER);
 257: // The following operations are to format the date and time in a
 258: // human readable format.
 259: // _REVISIT_: Use HiResolution timer to analyze the number of
 260: // Microseconds spent on formatting date object
 261: date.setTime(record.getMillis());
 262: recordBuffer.append(dateFormatter.format(date));
 263: recordBuffer.append(FIELD_SEPARATOR);
 264:
 265: recordBuffer.append(record.getLevel()).append(FIELD_SEPARATOR);
 266: recordBuffer.append(getProductId()).append(FIELD_SEPARATOR);
 267: recordBuffer.append(record.getLoggerName()).append(FIELD_SEPARATOR);
 268:
 269: recordBuffer.append("_ThreadID").append(NV_SEPARATOR);
 270: recordBuffer.append(record.getThreadID()).append(NVPAIR_SEPARATOR);
 271:
 272: recordBuffer.append("_ThreadName").append(NV_SEPARATOR);
 273: recordBuffer.append(Thread.currentThread().getName());
 274: recordBuffer.append(NVPAIR_SEPARATOR);
then in domain.xml enable the formatter attribute of the log-service element

      <log-service alarms="false" file="${com.sun.aas.instanceRoot}/logs/server.log" log-rotation-limit-in-bytes="2000000" log-rotation-timelimit-in-minutes="0" log-to-console="false" retain-error-statistics-for-hours="5" use-system-logging="false" com.sun.enterprise.server.logging.FileandSyslogHandler.formatter=com.sun.enterprise.server.logging.UniformLogFormatter>
</snip>
      </log-service>

http://docs.sun.com/app/docs/doc/820-4495/abluj?a=view

Martin Gainty
______________________________________________
Jogi és Bizalmassági kinyilatkoztatás/Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
 Ez az
üzenet bizalmas. Ha nem ön az akinek szánva volt, akkor kérjük, hogy
jelentse azt nekünk vissza. Semmiféle továbbítása vagy másolatának
készítése nem megengedett. Ez az üzenet csak ismeret cserét szolgál és
semmiféle jogi alkalmazhatósága sincs. Mivel az electronikus üzenetek
könnyen megváltoztathatóak, ezért minket semmi felelöség nem terhelhet
ezen üzenet tartalma miatt.

Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut ętre privilégié. Si vous n'ętes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert ŕ l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement ętre sujets ŕ la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.




> Date: Fri, 18 Dec 2009 08:09:56 +1000
> From: ed.hillmann_at_gmail.com
> To: users_at_glassfish.dev.java.net
> Subject: Q: Is there a way I can log access to the glassfish server?
>
> Hi all. We're using a Glassfish 2.1.1 server to host a web
> application. Part of what we want is to log access to the server. In
> this case, access to the server is not just the HTTP service access,
> but anyone connecting through JMX or even the Web console.
>
> I can see how to enable logging on the HTTP service. But is there any
> way to log access to the JMX or Admin Console? At the very least, I
> just need to log the timestamp of who accessed.
>
> Thanks for any info,
> Ed
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
                                               
_________________________________________________________________
Hotmail: Powerful Free email with security by Microsoft.
http://clk.atdmt.com/GBL/go/171222986/direct/01/