[logback-dev] svn commit: r2280 - in logback-demo/trunk: . src/main/java/ch/qos/logback/demo src/main/java/ch/qos/logback/demo/login src/main/resources src/main/resources/parts src/main/webapp src/main/webapp/includes
noreply.ceki at qos.ch
noreply.ceki at qos.ch
Thu Jun 11 15:23:28 CEST 2009
Author: ceki
Date: Thu Jun 11 15:23:27 2009
New Revision: 2280
Modified:
logback-demo/trunk/pom.xml
logback-demo/trunk/src/main/java/ch/qos/logback/demo/Constants.java
logback-demo/trunk/src/main/java/ch/qos/logback/demo/ViewLastLog.java
logback-demo/trunk/src/main/java/ch/qos/logback/demo/login/LoginAction.java
logback-demo/trunk/src/main/java/ch/qos/logback/demo/login/LogoutAction.java
logback-demo/trunk/src/main/resources/logback.xml
logback-demo/trunk/src/main/resources/parts/sifting.xml
logback-demo/trunk/src/main/webapp/includes/user.jsp
logback-demo/trunk/src/main/webapp/index.jsp
logback-demo/trunk/src/main/webapp/login.jsp
logback-demo/trunk/src/main/webapp/logout.jsp
Log:
correcting references to Constants
Modified: logback-demo/trunk/pom.xml
==============================================================================
--- logback-demo/trunk/pom.xml (original)
+++ logback-demo/trunk/pom.xml Thu Jun 11 15:23:27 2009
@@ -9,7 +9,7 @@
<version>1.0</version>
<properties>
- <lb.version>0.9.15-SNAPSHOT</lb.version>
+ <lb.version>0.9.16-SNAPSHOT</lb.version>
</properties>
Modified: logback-demo/trunk/src/main/java/ch/qos/logback/demo/Constants.java
==============================================================================
--- logback-demo/trunk/src/main/java/ch/qos/logback/demo/Constants.java (original)
+++ logback-demo/trunk/src/main/java/ch/qos/logback/demo/Constants.java Thu Jun 11 15:23:27 2009
@@ -3,7 +3,9 @@
public class Constants {
public static final String MGMNT_DOMAIN = "qos";
- public static final String USERID = "userid";
+ public static final String USERID_SESSION_KEY = "userid";
+ public static final String USERID_MDC_KEY = "userid";
+ public static final String USERNAME_PROPERTY = "username";
public static final String GUESSED_NUMBER = "guessed_number";
public static final Integer WINNING_NUMBER = new Integer(99);
Modified: logback-demo/trunk/src/main/java/ch/qos/logback/demo/ViewLastLog.java
==============================================================================
--- logback-demo/trunk/src/main/java/ch/qos/logback/demo/ViewLastLog.java (original)
+++ logback-demo/trunk/src/main/java/ch/qos/logback/demo/ViewLastLog.java Thu Jun 11 15:23:27 2009
@@ -29,7 +29,7 @@
CyclicBufferAppender cyclicBufferAppender;
HTMLLayout layout;
- static String PATTERN = "%d%thread%level%logger{25}%mdc{" + Constants.USERID
+ static String PATTERN = "%d%thread%level%logger{25}%mdc{" + Constants.USERID_MDC_KEY
+ "}%msg";
@Override
Modified: logback-demo/trunk/src/main/java/ch/qos/logback/demo/login/LoginAction.java
==============================================================================
--- logback-demo/trunk/src/main/java/ch/qos/logback/demo/login/LoginAction.java (original)
+++ logback-demo/trunk/src/main/java/ch/qos/logback/demo/login/LoginAction.java Thu Jun 11 15:23:27 2009
@@ -26,9 +26,9 @@
String username = form.getUsername();
if (username != null) {
- MDC.put(Constants.USERID, username);
+ MDC.put(Constants.USERID_MDC_KEY, username);
logger.info("Login: " + username + " just logged in.");
- request.getSession().setAttribute(Constants.USERID, username);
+ request.getSession().setAttribute(Constants.USERID_SESSION_KEY, username);
request.setAttribute("a", username);
}
}
Modified: logback-demo/trunk/src/main/java/ch/qos/logback/demo/login/LogoutAction.java
==============================================================================
--- logback-demo/trunk/src/main/java/ch/qos/logback/demo/login/LogoutAction.java (original)
+++ logback-demo/trunk/src/main/java/ch/qos/logback/demo/login/LogoutAction.java Thu Jun 11 15:23:27 2009
@@ -21,13 +21,13 @@
ActionForm actionForm, HttpServletRequest request,
HttpServletResponse response) throws Exception {
- String username = (String)request.getSession().getAttribute(Constants.USERID);
+ String username = (String)request.getSession().getAttribute(Constants.USERID_SESSION_KEY);
- MDC.remove(Constants.USERID);
+ MDC.remove(Constants.USERID_MDC_KEY);
logger.info("User: " + username + " just logged out.");
- request.setAttribute(Constants.USERID, username);
- request.getSession().removeAttribute(Constants.USERID);
+ request.setAttribute(Constants.USERID_SESSION_KEY, username);
+ request.getSession().removeAttribute(Constants.USERID_SESSION_KEY);
return actionMapping.findForward("next");
}
Modified: logback-demo/trunk/src/main/resources/logback.xml
==============================================================================
--- logback-demo/trunk/src/main/resources/logback.xml (original)
+++ logback-demo/trunk/src/main/resources/logback.xml Thu Jun 11 15:23:27 2009
@@ -35,7 +35,7 @@
</appender>
-->
- <!-- Cyclic buffer with Evaluator -->
+ <!-- Cyclic buffer with Evaluator
<appender name="CYCLIC"
class="ch.qos.logback.core.read.CyclicBufferAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
@@ -50,28 +50,8 @@
</filter>
<MaxSize>512</MaxSize>
</appender>
-
- <appender name="SIFT"
- class="ch.qos.logback.classic.sift.SiftingAppender">
- <discriminator>
- <Key>userid</Key>
- <DefaultValue>unknown</DefaultValue>
- </discriminator>
- <sift>
- <appender name="FILE-${userid}"
- class="ch.qos.logback.core.FileAppender">
- <File>${userid}.log</File>
- <Append>false</Append>
- <layout>
- <Pattern>
- %d [%thread] %55(%5level %10mdc %logger{35}) - %msg%n
- </Pattern>
- </layout>
- </appender>
- </sift>
- </appender>
-
-
+ -->
+
<!-- TurboFilter: by MDC value
<turboFilter class="ch.qos.logback.classic.turbo.MDCFilter">
@@ -95,8 +75,7 @@
<root level="${lb_level:-ERROR}">
<appender-ref ref="STDOUT" />
- <appender-ref ref="SIFT" />
- <appender-ref ref="CYCLIC" />
+ <appender-ref ref="FILE" />
</root>
</configuration>
Modified: logback-demo/trunk/src/main/resources/parts/sifting.xml
==============================================================================
--- logback-demo/trunk/src/main/resources/parts/sifting.xml (original)
+++ logback-demo/trunk/src/main/resources/parts/sifting.xml Thu Jun 11 15:23:27 2009
@@ -1,16 +1,18 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-
- <appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
+ <appender name="SIFT"
+ class="ch.qos.logback.classic.sift.SiftingAppender">
<discriminator>
<Key>userid</Key>
<DefaultValue>unknown</DefaultValue>
</discriminator>
<sift>
- <appender name="FILE-${userid}" class="ch.qos.logback.core.FileAppender">
+ <appender name="FILE-${userid}"
+ class="ch.qos.logback.core.FileAppender">
<File>${userid}.log</File>
<Append>false</Append>
<layout>
- <Pattern>%d [%thread] %level %mdc %logger{35} - %msg%n</Pattern>
+ <Pattern>
+ %d [%thread] %55(%5level %10mdc %logger{35}) - %msg%n
+ </Pattern>
</layout>
</appender>
</sift>
Modified: logback-demo/trunk/src/main/webapp/includes/user.jsp
==============================================================================
--- logback-demo/trunk/src/main/webapp/includes/user.jsp (original)
+++ logback-demo/trunk/src/main/webapp/includes/user.jsp Thu Jun 11 15:23:27 2009
@@ -1,6 +1,6 @@
<%@page import="ch.qos.logback.demo.Constants"%>
<%
-String username = (String)session.getAttribute(Constants.USER);
+String username = (String)session.getAttribute(Constants.USERID_SESSION_KEY);
String text;
if (username == null) {
text = "No user logged in.";
Modified: logback-demo/trunk/src/main/webapp/index.jsp
==============================================================================
--- logback-demo/trunk/src/main/webapp/index.jsp (original)
+++ logback-demo/trunk/src/main/webapp/index.jsp Thu Jun 11 15:23:27 2009
@@ -15,9 +15,9 @@
<div class="content">
-<logic:notEmpty name="<%=Constants.USER %>">
+<logic:notEmpty name="<%=Constants.USERID_SESSION_KEY %>">
<p>
- Hi there, <bean:write name="<%=Constants.USER %>" /> !
+ Hi there, <bean:write name="<%=Constants.USERID_SESSION_KEY %>" /> !
</p>
</logic:notEmpty>
<p>
Modified: logback-demo/trunk/src/main/webapp/login.jsp
==============================================================================
--- logback-demo/trunk/src/main/webapp/login.jsp (original)
+++ logback-demo/trunk/src/main/webapp/login.jsp Thu Jun 11 15:23:27 2009
@@ -18,7 +18,7 @@
<html:form action="/Login">
<html:errors />
-<p><html:text size="15" property="<%=Constants.USER %>"></html:text></p>
+<p><html:text size="15" property="<%=Constants.USERNAME_PROPERTY %>"></html:text></p>
<p><html:submit>Submit</html:submit></p>
</html:form>
Modified: logback-demo/trunk/src/main/webapp/logout.jsp
==============================================================================
--- logback-demo/trunk/src/main/webapp/logout.jsp (original)
+++ logback-demo/trunk/src/main/webapp/logout.jsp Thu Jun 11 15:23:27 2009
@@ -14,7 +14,7 @@
<%@include file="includes/menu.jsp"%>
<%
-String user = (String)request.getAttribute(Constants.USER);
+String user = (String)request.getAttribute(Constants.USERID_SESSION_KEY);
String display;
if (user == null || user.trim().length() == 0) {
display = "No user were connected";
More information about the logback-dev
mailing list