Announcement Announcement Module
Collapse
No announcement yet.
Newbie: logging acegi messages Page Title Module
Move Remove Collapse
This topic is closed
X
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie: logging acegi messages

    Hi,

    I am new to Acegi and has just implemented the login page for my own application. For the most part, I simply miniked whatever is done in the acegi-security-sample-contacts-filter example. My current problem is that the login always fails and I am trying to find out why. I have configured the Log4jConfigListener listerner in web.xml, but I am not seeing any debug messages the Tomcat server.log file either when I start Tomcat or when I submit the login.jsp. I noticed that I can see all sort of trace messages (DEBUG/INFO) for the acegi-security-sample-contacts-filter example when I start Tomcat or when I navigate through the application. So I went back and took a closer look at the security.xml file in the example. I found that it has the following line that I don't have:
    Code:
    <bean id="loggerListener" class="net.sf.acegisecurity.providers.dao.event.LoggerListener"/>
    After I added that line, I still cannot see any Acegi log messages when I start Tomcat, although now I get the following in the server.log every time I try to submit my login page
    Code:
    Sep 22, 2005 7&#58;09&#58;34 PM net.sf.acegisecurity.providers.dao.event.LoggerListener onApplicationEvent
    WARNING&#58; Authentication failed due to nonexistent username&#58; abc; details&#58; net.sf.acegisecurity.ui.WebAuthenticationDetails@10c94a7&#58; RemoteIpAddress&#58; 127.0.0.1; SessionId&#58; F1809D80D6BEE55512BD4E580918860B
    There must be some way to get Acegi to log more detailed messages, as the example was able to. Can anyone please tell me how?

    Any help would be appreciated.
    Thanks in advance.

    Carlos


    I have the following in my web.xml:
    Code:
    	<context-param>
    		<param-name>log4jConfigLocation</param-name>
    		<param-value>/WEB-INF/classes/log4j.properties</param-value>
    	</context-param>
    
    	<listener>
        		<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    	</listener>
    and I have the following in my log4j.properties file:
    Code:
    # Global logging configuration
    log4j.rootLogger=WARN, stdout, fileout
    
    log4j.logger.org.springframework.aop.framework.autoproxy=DEBUG, stdout, fileout
    log4j.logger.org.springframework.aop.framework.autoproxy.metadata=DEBUG, stdout, fileout
    log4j.logger.org.springframework.aop.framework.autoproxy.target=DEBUG, stdout, fileout
    log4j.logger.org.springframework.transaction.interceptor=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.intercept=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.intercept.method=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.intercept.web=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.afterinvocation=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.acl=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.acl.basic=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.taglibs.authz=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.ui.basicauth=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.ui.rememberme=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.ui=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.afterinvocation=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.ui.rmi=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.ui.httpinvoker=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.util=DEBUG, stdout, fileout
    log4j.logger.net.sf.acegisecurity.providers.dao=DEBUG, stdout, fileout
    #log4j.logger.sample.contact=DEBUG, stdout, fileout
    
    # Console output...
    log4j.appender.stdout=org.apache.log4j.ConsoleAppender
    log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
    log4j.appender.stdout.layout.conversionPattern=&#91;%p,%c&#123;1&#125;,%t&#93; %m%n
    
    # Rolling log file output...
    log4j.appender.fileout=org.apache.log4j.RollingFileAppender
    log4j.appender.fileout.File=contacts.log
    log4j.appender.fileout.File=$&#123;webapp.root&#125;/WEB-INF/log4j.log
    log4j.appender.fileout.MaxFileSize=1024KB
    log4j.appender.fileout.MaxBackupIndex=1
    log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
    log4j.appender.fileout.layout.conversionPattern=%d&#123;ABSOLUTE&#125; %5p %c&#123;1&#125;,%t&#58;%L - %m%n

  • #2
    Acegi Security uses Commons Logging.

    LoggerListener is not really required for seeing debug-level logging. The actual source code for Acegi Security will always use Commons Logging, irrespective of whether LoggerListener is also used.

    The problem is basically configuration of Commons Logging + Log4j + Tomcat. Try searching the forum. I just found a couple of posts:

    http://forum.springframework.org/showthread.php?t=17926
    http://forum.springframework.org/showthread.php?t=15940
    Last edited by robyn; May 14th, 2006, 07:31 PM.

    Comment


    • #3
      Double log messages

      Hey there,

      Anybody ever had this problem? I keep getting double log messages in my eclipse's console.

      I have the loggerListener configured as:
      Code:
          <!-- Automatically receives AuthenticationEvent messages -->
          <bean id="loggerListener" class="org.acegisecurity.event.authentication.LoggerListener" />
      And I have a log4j.properties on my classpath which defines:
      Code:
      # Global logging configuration
      log4j.rootLogger=WARN, stdout, fileout
      
      log4j.logger.org.acegisecurity=DEBUG, stdout, fileout
      
      # Console output...
      log4j.appender.stdout=org.apache.log4j.ConsoleAppender
      log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
      log4j.appender.stdout.layout.conversionPattern=[%p,%c{1},%t] %m%n
      
      # Rolling log file output...
      log4j.appender.fileout=org.apache.log4j.RollingFileAppender
      log4j.appender.fileout.File=athena.log
      #log4j.appender.fileout.File=${webapp.root}/WEB-INF/log4j.log
      log4j.appender.fileout.MaxFileSize=1024KB
      log4j.appender.fileout.MaxBackupIndex=1
      log4j.appender.fileout.layout=org.apache.log4j.PatternLayout
      log4j.appender.fileout.layout.conversionPattern=%d{ABSOLUTE} %5p %c{1},%t:%L - %m%n
      Any guesses?

      Cheers!

      Renato Back

      Comment

      Working...
      X