<div dir="ltr"><div>Hello All,</div><div>I came to know that the shibboleth using Slf4j for printing logs(idp-audit.log, idp-process.log).This Slf4j is implemented with "logback" to printing the files in the log files. Now we have our application which is configuraed with SSO by using shibboleth-2.4.0. We are using "ExternalAuthn" Login handler. In "ExternaAuthn" login handler externalAuthnPath="/ext/ExternalLogin" which is a servlet. In this servlet we have written log messages. but this servlet code is generated as a "jar" file and putting into the idp/Web-inf/libs along with shibboleth libs.while runnging the application we are not able to see the logs in console as well as in the file also.</div><div><br></div><div>Application specific thing depends on shibboleth idp:</div><div>We are using Slf4j and implementing slf4j with log4j to print the logs in console as well as in the file.The code which we are trying to printing the logs from created jar which is placed in the tomcat(idp/Web-Inf/lib) but when running the application i am not able to see printing the logs in the console.</div><div><br></div><div>Please look into the follwoing configuration configured for jar:</div><div><br></div><div>    log4j.category.sample.sso.application=Debug, file, C</div><div>    log4j.additivity.sample.sso.application=true</div><div>    </div><div>    log4j.appender.C=org.apache.log4j.ConsoleAppender</div><div>    log4j.appender.C.Target=System.out</div><div>    log4j.appender.C.ImmediateFlush=true</div><div>    log4j.appender.C.layout=org.apache.log4j.PatternLayout</div><div>    log4j.appender.C.layout.ConversionPattern=%-5p %d [%t] %m%n</div><div>    </div><div>    </div><div>    ### direct messages to file ###</div><div>    log4j.appender.file=org.apache.log4j.RollingFileAppender</div><div>    log4j.appender.file.File=${catalina.home}/var/ipau/logs/ssoapplication.log</div><div>    log4j.appender.file.Append=true</div><div>    log4j.appender.file.MaxFileSize=10MB</div><div>    # mylog.log.10 \u307e\u3067\u4fdd\u6301</div><div>    log4j.appender.file.MaxBackupIndex=50</div><div>    log4j.appender.file.layout=org.apache.log4j.PatternLayout</div><div>    log4j.appender.file.layout.ConversionPattern=%d %5p [%t] %c{1} - %m%n</div><div>    </div><div>    log4j.rootLogger=INFO, C, file</div><div><br></div><div>My project structure is: </div><div><br></div><div>Sample--</div><div>    src--</div><div>       sample--</div><div>          sso--</div><div>            application</div><div>       log4j.properties.</div><div><br></div><div>I am preparing the jar file from the above structure and placed in the other war file in the tomcat.</div><div>As suggested in the Stackover flow,  i tried by reading the log4j.properties file externally which is below.</div><div><br></div><div>    import java.io.File;</div><div>    import java.io.FileInputStream;</div><div>    import java.io.IOException;</div><div>    import java.io.InputStream;</div><div>    import java.io.Writer;</div><div>    import java.util.Properties;</div><div>    import java.util.regex.Matcher;</div><div>    </div><div>    import javax.servlet.ServletException;</div><div>    import javax.servlet.http.Cookie;</div><div>    import javax.servlet.http.HttpServlet;</div><div>    import javax.servlet.http.HttpServletRequest;</div><div>    import javax.servlet.http.HttpServletResponse;</div><div>    </div><div>    import org.apache.commons.codec.binary.Base64;</div><div>    import org.apache.log4j.PropertyConfigurator;</div><div>    import org.slf4j.Logger;</div><div>    import org.slf4j.LoggerFactory;</div><div>    </div><div>     </div><div>    public class PreProcessServlet extends HttpServlet {</div><div>    </div><div>    <span class="" style="white-space:pre">  </span>private static final long serialVersionUID = -572799841125956990L;</div><div>    <span class="" style="white-space:pre">   </span>    </div><div>    <span class="" style="white-space:pre">       </span>PreLoginServlet() {</div><div>    <span class="" style="white-space:pre">  </span>    </div><div>    <span class="" style="white-space:pre">       </span>}</div><div>    <span class="" style="white-space:pre">    </span>    </div><div>    <span class="" style="white-space:pre">                               </span></div><div>    </div><div>    <span class="" style="white-space:pre">       </span>protected void service(HttpServletRequest request,</div><div>    <span class="" style="white-space:pre">                   </span>HttpServletResponse response) throws ServletException, IOException {</div><div>    <span class="" style="white-space:pre"> </span>    try {</div><div>              FileInputStream fis = new FileInputStream(new File("/log4j.properties"));</div><div>    //          InputStream input = this.class.getClassLoader().getResourceAsStream("log4j.properties");</div><div>              Properties prop = new Properties();</div><div>              prop.load(fis);</div><div>              PropertyConfigurator.configure(prop);</div><div>          } catch (IOException e) {</div><div>              e.printStackTrace();</div><div>              System.out.println("ERROR: Unable to load log4j.properties");</div><div>          }</div><div>    <span class="" style="white-space:pre">       </span>    final Logger log = LoggerFactory</div><div>    <span class="" style="white-space:pre">       </span>            .getLogger(PreProcessServlet .class); </div><div>    <span class="" style="white-space:pre">            </span>log.debug("Pre login process is started");</div><div>    <span class="" style="white-space:pre">         </span></div><div>    <span class="" style="white-space:pre">             </span>System.out.println("sys printing");</div><div>    <span class="" style="white-space:pre">                </span>Boolean parametersAreValid = true;</div><div>    <span class="" style="white-space:pre">           </span>RegularExpression regularExpression = RegularExpression.getInstance();</div><div>    <span class="" style="white-space:pre">               </span></div><div>    <span class="" style="white-space:pre">             </span></div><div>    <span class="" style="white-space:pre">             </span>String sessionId = request.getParameter(GlobalStrings.sessionId);</div><div>    <span class="" style="white-space:pre">            </span>if (null != sessionId){</div><div>    <span class="" style="white-space:pre">                      </span>Matcher sessionIdMatcher = regularExpression.getSessionPattern().matcher(sessionId);</div><div>    <span class="" style="white-space:pre">                 </span>if ((sessionId.equals(GlobalStrings.nullString)) ||</div><div>    <span class="" style="white-space:pre">                                  </span>(!sessionId.equals(GlobalStrings.nullString) && sessionIdMatcher.find())){</div><div>    <span class="" style="white-space:pre">                           </span>log.error("PreLoginServlet "+ "Invalid SessionID " + sessionId);</div><div>    <span class="" style="white-space:pre">                         </span>parametersAreValid = false;</div><div>    <span class="" style="white-space:pre">                  </span>}</div><div>    <span class="" style="white-space:pre">            </span>}else{</div><div>    <span class="" style="white-space:pre">                       </span><a href="http://log.info">log.info</a>("sessionId field is empty");</div><div>    <span class="" style="white-space:pre">          </span>}</div><div>    <span class="" style="white-space:pre">    </span></div><div>    }</div><div><br></div><div>Update: I got the following error even i have added dependency libs(slf4j-log4j12-1.7.5, log4j along with slf4j):</div><div>SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".</div><div>SLF4J: Defaulting to no-operation (NOP) logger implementation</div><div>SLF4J: See <a href="http://www.slf4j.org/codes.html#StaticLoggerBinder">http://www.slf4j.org/codes.html#StaticLoggerBinder</a> for further details.</div><div>         </div><div>       </div><div>Could you please help any body to solve this problem.</div><div><br></div><div><br></div><div><br></div><div><br></div><div> </div><div>Thanks in advance.</div></div>