[logback-dev] [GIT] Logback: the generic, reliable, fast and flexible logging framework. branch, master, updated. v_0.9.21-1-g2cec26a
added by portage for gitosis-gentoo
git-noreply at pixie.qos.ch
Wed May 12 23:57:38 CEST 2010
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Logback: the generic, reliable, fast and flexible logging framework.".
The branch, master has been updated
via 2cec26a3063cfa89133cc83e13e07f3c4a2d7746 (commit)
from dbc4e3608b4e351bad6c6c15f7aefe4b6d569554 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://git.qos.ch/gitweb/?p=logback.git;a=commit;h=2cec26a3063cfa89133cc83e13e07f3c4a2d7746
http://github.com/ceki/logback/commit/2cec26a3063cfa89133cc83e13e07f3c4a2d7746
commit 2cec26a3063cfa89133cc83e13e07f3c4a2d7746
Author: Ceki Gulcu <ceki at qos.ch>
Date: Wed May 12 23:54:43 2010 +0200
- started working on a Groovy configurator called gaffer
diff --git a/logback-access/pom.xml b/logback-access/pom.xml
index 978ff23..e94ff01 100644
--- a/logback-access/pom.xml
+++ b/logback-access/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-parent</artifactId>
- <version>0.9.21</version>
+ <version>0.9.22-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/logback-classic/pom.xml b/logback-classic/pom.xml
index 8fcdb8d..d1a8691 100644
--- a/logback-classic/pom.xml
+++ b/logback-classic/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-parent</artifactId>
- <version>0.9.21</version>
+ <version>0.9.22-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy
new file mode 100644
index 0000000..8ba018b
--- /dev/null
+++ b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy
@@ -0,0 +1,101 @@
+package ch.qos.logback.classic.gaffer;
+
+import ch.qos.logback.core.util.Duration;
+import groovy.lang.Closure;
+
+import java.util.Map
+import ch.qos.logback.core.Context
+import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter
+import ch.qos.logback.classic.LoggerContext
+import ch.qos.logback.core.spi.ContextAwareImpl
+import ch.qos.logback.core.spi.ContextAwareBase
+import ch.qos.logback.classic.Level
+import ch.qos.logback.classic.Logger
+import ch.qos.logback.core.Appender;
+
+/**
+ * @author Ceki Gücü
+ */
+
+ at Mixin(ContextAwareBase)
+public class ConfigurationDelegate {
+
+ List<Appender> appenderList = [];
+
+ void configuration(Closure closure) {
+ configuration([:], closure)
+ }
+
+
+ void configuration(Map map, Closure closure) {
+ processScanAttributes(map.scan, map.scanPeriod);
+ }
+
+ private void processScanAttributes(boolean scan, String scanPeriodStr) {
+ if (scan) {
+ ReconfigureOnChangeFilter rocf = new ReconfigureOnChangeFilter();
+ rocf.setContext(context);
+ if (scanPeriodStr) {
+ try {
+ Duration duration = Duration.valueOf(scanPeriodStr);
+ rocf.setRefreshPeriod(duration.getMilliseconds());
+ addInfo("Setting ReconfigureOnChangeFilter scanning period to "
+ + duration);
+ } catch (NumberFormatException nfe) {
+ addError("Error while converting [" + scanAttrib + "] to long", nfe);
+ }
+ }
+ rocf.start();
+ addInfo("Adding ReconfigureOnChangeFilter as a turbo filter");
+ context.addTurboFilter(rocf);
+ }
+ }
+
+ void root(Level level, List<String> appenderNames = []) {
+ if (level == null) {
+ addError("Root logger cannot be set to level null");
+ } else {
+ logger(org.slf4j.Logger.ROOT_LOGGER_NAME, level, appenderNames);
+ }
+ }
+
+ void logger(String name, Level level, List<String> appenderNames = [], Boolean additivity = null) {
+ if (name) {
+ Logger logger = ((LoggerContext) context).getLogger(name);
+ logger.level = level;
+
+ if (appenderNames) {
+ appenderNames.each { aName ->
+ Appender appender = appenderList.find { it.name == aName };
+ if (appender != null) {
+ logger.addAppender(appender);
+ } else {
+ addError("Failed to find appender named [${it.name}]");
+ }
+ }
+ }
+
+ if (additivity != null) {
+ logger.additive = additivity;
+ }
+ } else {
+ addInfo("No name attribute for logger");
+ }
+ }
+
+ void appender(String name, Class clazz, Closure closure = null) {
+ Appender appender = clazz.newInstance();
+ appender.name = name
+ appender.context = context
+ appenderList.add(appender)
+ if (closure != null) {
+ AppenderDelegate ad = new AppenderDelegate(appender);
+ ad.context = context;
+ closure.delegate = ad;
+ closure.resolveStrategy = Closure.DELEGATE_FIRST
+ closure();
+ }
+ appender.start();
+ }
+}
+
diff --git a/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/Configurator.groovy b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/Configurator.groovy
new file mode 100644
index 0000000..9c18e68
--- /dev/null
+++ b/logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/Configurator.groovy
@@ -0,0 +1,49 @@
+/**
+ * Logback: the reliable, generic, fast and flexible logging framework.
+ * Copyright (C) 1999-2010, QOS.ch. All rights reserved.
+ *
+ * This program and the accompanying materials are dual-licensed under
+ * either the terms of the Eclipse Public License v1.0 as published by
+ * the Eclipse Foundation
+ *
+ * or (per the licensee's choosing)
+ *
+ * under the terms of the GNU Lesser General Public License version 2.1
+ * as published by the Free Software Foundation.
+ */
+package ch.qos.logback.classic.gaffer
+
+class Configurator {
+
+ static void main(String[] args) {
+ runArchitectureRules(new File("src/ch/test/toto.groovy"))
+ }
+
+ static void runArchitectureRules(File dsl) {
+ //LoggerFactory loggerFactory = new LoggerFactory();
+ ConfigurationDelegate configurationDelegate = new ConfigurationDelegate();
+ //AppenderAction appenderAction = new AppenderAction();
+
+
+ Binding binding = new Binding();
+ binding.setProperty("DEBUG", new Integer(1));
+ Script dslScript = new GroovyShell(binding).parse(dsl.text)
+ ExpandoMetaClass emc = new ExpandoMetaClass(dslScript.class, false);
+
+ //configurationDelegate.metaClass.logger = loggerFactory.&logger
+ //configurationDelegate.metaClass.appender = appenderAction.&appender
+
+ emc.configuration = {Closure cl ->
+ println "executing configuration"
+ cl.delegate = configuration
+ cl();
+ }
+
+
+ emc.initialize();
+ dslScript.metaClass = emc;
+
+ dslScript.run()
+ }
+
+}
\ No newline at end of file
diff --git a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/AppenderDelegate.groovy b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/AppenderDelegate.groovy
new file mode 100644
index 0000000..3898a41
--- /dev/null
+++ b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/AppenderDelegate.groovy
@@ -0,0 +1,32 @@
+package ch.qos.logback.classic.gaffer
+
+import ch.qos.logback.core.Appender
+import ch.qos.logback.core.spi.ContextAwareBase
+
+/**
+ * @author Ceki Gücü
+ */
+ at Mixin(ContextAwareBase)
+class AppenderDelegate {
+
+ Appender appender;
+
+ AppenderDelegate(Appender appender) {
+ this.appender = appender;
+ }
+
+ void methodMissing(String name, args) {
+ println "method $name accessed"
+ }
+
+ void propertyMissing(String name, def value) {
+ println "-- propertyMissing"
+ if(appender.hasProperty(name)) {
+ //println "-- appender has property $name"
+ appender."${name}" = value;
+ } else {
+ //println "-- appender does not have property [$name]"
+ addError("Appender [${appender.name}] of type [${appender.getClass().canonicalName}] has no [${name}] property " )
+ }
+ }
+}
diff --git a/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy
new file mode 100644
index 0000000..7125a97
--- /dev/null
+++ b/logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy
@@ -0,0 +1,135 @@
+package ch.qos.logback.classic.gaffer
+
+import ch.qos.logback.classic.LoggerContext
+import org.junit.Before
+import org.junit.Test
+import static org.junit.Assert.*
+import ch.qos.logback.core.status.StatusChecker
+import ch.qos.logback.classic.turbo.TurboFilter
+import ch.qos.logback.classic.turbo.ReconfigureOnChangeFilter
+import ch.qos.logback.classic.Level
+import ch.qos.logback.core.testUtil.RandomUtil
+import ch.qos.logback.classic.Logger
+import ch.qos.logback.core.Appender
+import ch.qos.logback.core.helpers.NOPAppender
+import ch.qos.logback.core.ConsoleAppender
+
+/**
+ * @author Ceki Gücü
+ */
+class ConfigurationDelegateTest {
+
+
+ LoggerContext context = new LoggerContext()
+ ConfigurationDelegate configurationDelegate = new ConfigurationDelegate();
+ StatusChecker statusChecker = new StatusChecker(context)
+ int diff = RandomUtil.getPositiveInt();
+
+ @Before
+ void setUp() {
+ context.name = "ConfigurationDelegateTest"
+ configurationDelegate.context = context;
+ }
+
+ @Test
+ void contextAwareMixin() {
+ configurationDelegate.addInfo("smoke")
+ assertTrue(statusChecker.containsMatch("smoke"))
+ }
+
+ @Test
+ void scan() {
+ configurationDelegate.configuration([scan: true, scanPeriod: "10seconds"]) {}
+ assertTrue(statusChecker.containsMatch("Setting ReconfigureOnChangeFilter"))
+ assertTrue(statusChecker.containsMatch("Adding ReconfigureOnChangeFilter as a turbo filter"))
+
+ TurboFilter filter = context.turboFilterList[0]
+ assertTrue(filter instanceof ReconfigureOnChangeFilter)
+ ReconfigureOnChangeFilter rocf = (ReconfigureOnChangeFilter) filter;
+ assertEquals(10 * 1000, rocf.refreshPeriod)
+ }
+
+ @Test
+ void loggerWithoutName() {
+ configurationDelegate.logger("", Level.DEBUG)
+ assertTrue(statusChecker.containsMatch("No name attribute for logger"))
+ }
+
+ @Test
+ void loggerSetLevel() {
+ configurationDelegate.logger("setLevel" + diff, Level.INFO)
+ Logger smokeLogger = context.getLogger("setLevel" + diff);
+ assertEquals(Level.INFO, smokeLogger.level)
+ }
+
+
+ @Test
+ void loggerAppenderRef() {
+ Appender fooAppender = new NOPAppender();
+ fooAppender.name = "FOO"
+ configurationDelegate.appenderList = [fooAppender]
+ configurationDelegate.logger("test" + diff, Level.INFO, ["FOO"])
+ Logger logger = context.getLogger("test" + diff);
+ assertEquals(Level.INFO, logger.level)
+ assertEquals(fooAppender, logger.getAppender("FOO"))
+ }
+
+ @Test
+ void loggerAdditivity() {
+ Appender fooAppender = new NOPAppender();
+ fooAppender.name = "FOO"
+ configurationDelegate.appenderList = [fooAppender]
+ configurationDelegate.logger("test" + diff, Level.INFO, ["FOO"], false)
+ Logger logger = context.getLogger("test" + diff);
+ assertEquals(Level.INFO, logger.level)
+ assertEquals(fooAppender, logger.getAppender("FOO"))
+ assertEquals(false, logger.additive)
+ }
+
+ @Test
+ void loggerAdditivittWithEmptyList() {
+ configurationDelegate.logger("test" + diff, Level.INFO, [], false)
+ Logger logger = context.getLogger("test" + diff);
+ assertEquals(Level.INFO, logger.level)
+ assertEquals(null, logger.getAppender("FOO"))
+ assertEquals(false, logger.additive)
+ }
+
+ @Test
+ void root_LEVEL() {
+ configurationDelegate.root(Level.ERROR)
+ Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME);
+ assertEquals(Level.ERROR, root.level)
+ assertEquals(null, root.getAppender("FOO"))
+ }
+
+ @Test
+ void root_WithList() {
+ Appender fooAppender = new NOPAppender();
+ fooAppender.name = "FOO"
+ configurationDelegate.appenderList = [fooAppender]
+ configurationDelegate.root(Level.WARN, ["FOO"])
+ Logger root = context.getLogger(Logger.ROOT_LOGGER_NAME);
+ assertEquals(Level.WARN, root.level)
+ assertEquals(fooAppender, root.getAppender("FOO"))
+ }
+
+ @Test
+ void appender0() {
+ configurationDelegate.appender("A", NOPAppender);
+ Appender back = configurationDelegate.appenderList.find {it.name = "A"}
+ assertNotNull(back)
+ assertEquals("A", back.name)
+ }
+
+ @Test
+ void appender1() {
+ configurationDelegate.appender("C", ConsoleAppender) {
+ target = "System.err"
+ }
+ Appender back = configurationDelegate.appenderList.find {it.name = "C"}
+ assertNotNull(back)
+ assertEquals("C", back.name)
+ assertEquals("System.err", back.target)
+ }
+}
diff --git a/logback-core/pom.xml b/logback-core/pom.xml
index 62c2eb3..9c96cf3 100644
--- a/logback-core/pom.xml
+++ b/logback-core/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-parent</artifactId>
- <version>0.9.21</version>
+ <version>0.9.22-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -45,6 +45,15 @@
<scope>compile</scope>
<optional>true</optional>
</dependency>
+
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <scope>compile</scope>
+ <optional>true</optional>
+ </dependency>
+
+
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
@@ -87,6 +96,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.5</source>
+ <target>1.5</target>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>once</forkMode>
diff --git a/logback-examples/pom.xml b/logback-examples/pom.xml
index e361f49..92b3030 100644
--- a/logback-examples/pom.xml
+++ b/logback-examples/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-parent</artifactId>
- <version>0.9.21</version>
+ <version>0.9.22-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/logback-site/pom.xml b/logback-site/pom.xml
index aadcba1..80f6b58 100644
--- a/logback-site/pom.xml
+++ b/logback-site/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-parent</artifactId>
- <version>0.9.21</version>
+ <version>0.9.22-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/logback-site/src/site/pages/codes.html b/logback-site/src/site/pages/codes.html
index 6ca3d07..27607c5 100644
--- a/logback-site/src/site/pages/codes.html
+++ b/logback-site/src/site/pages/codes.html
@@ -62,47 +62,75 @@
<p class="red bold">from (DEPRECATED)</p>
<pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>testFile.log</file>
- ...
- <layout class="ch.qos.logback.classic.PatternLayout">
- <pattern>%msg%n</pattern>
- </layout>
- </appender> </pre>
+ <file>testFile.log</file>
+ ...
+ <layout class="ch.qos.logback.classic.PatternLayout">
+ <pattern>%msg%n</pattern>
+ </layout>
+</appender> </pre>
<p class="red bold">or the shorter equivalent (DEPRECATED)</p>
<pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>testFile.log</file>
- ...
- <!-- layout are assigned the type
- ch.qos.logback.classic.PatternLayout by default -->
- <layout>
- <pattern>%msg%n</pattern>
- </layout>
- </appender> </pre>
+ <file>testFile.log</file>
+ ...
+ <!-- layout are assigned the type ch.qos.logback.classic.PatternLayout by default -->
+ <layout>
+ <pattern>%msg%n</pattern>
+ </layout>
+</appender> </pre>
<p class="green bold">to (GOOD)</p>
<pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>testFile.log</file>
- ...
- <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
- <pattern>%msg%n</pattern>
- </encode>
- </appender> </pre>
+ <file>testFile.log</file>
+ ...
+ <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
+ <pattern>%msg%n</pattern>
+ </encode>
+</appender> </pre>
<p class="green bold">or the shorter equivalent (GOOD)</p>
<pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender">
- <file>testFile.log</file>
- ...
- <!-- encoders are assigned the type
- ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
- <encoder>
- <pattern>%msg%n</pattern>
- </encode>
- </appender> </pre>
+ <file>testFile.log</file>
+ ...
+ <!-- encoders are assigned the type
+ ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
+ <encoder>
+ <pattern>%msg%n</pattern>
+ </encode>
+</appender> </pre>
+
+
+ <p>For layout type other than <code>PatternLayout</code>, for
+ example <code>HTMLLayout</code>, your configuration files need to be
+ changed
+ </p>
+ <p class="red bold">from (DEPRECATED)</p>
+
+ <pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>testFile.log</file>
+ ...
+ <layout class="ch.qos.logback.classic.html.HTMLLayout">
+ <pattern>%msg%n</pattern>
+ </layout>
+</appender> </pre>
+
+
+ <p class="green bold">to (GOOD)</p>
+ <pre class="prettyprint source"><appender name="FILE" class="ch.qos.logback.core.FileAppender">
+ <file>testFile.log</file>
+ ...
+ <encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
+ <layout class="ch.qos.logback.classic.html.HTMLLayout">
+ <pattern>%msg%n</pattern>
+ </layout>
+ </encoder>
+</appender> </pre>
+
+
<p>We hope to make up for this inconvenience with cool new features
which are only possible using encoders. <b>During a transition
diff --git a/logback-site/src/site/pages/css/popup.css b/logback-site/src/site/pages/css/popup.css
new file mode 100644
index 0000000..2b20468
--- /dev/null
+++ b/logback-site/src/site/pages/css/popup.css
@@ -0,0 +1,67 @@
+
+/* =========== popup ================== */
+#backgroundPopup {
+ display:none;
+ position:fixed;
+ _position:absolute; /* hack for internet explorer 6*/
+ height:100%;
+ width:100%;
+ top:0;
+ left:0;
+ background:#000000;
+ border:1px solid #cecece;
+ z-index:1;
+}
+
+#popupContents {
+ display:none;
+ position:fixed;
+ _position:absolute; /* hack for internet explorer 6*/
+ height: 150px;
+ width: 408px;
+ background:#FFFFFF;
+ border: 2px solid #cecece;
+ z-index:2;
+ padding-left: 1ex;
+ font-size:13px;
+}
+
+#popupContents p {
+ margin: 0px;
+}
+#popupContents h3 {
+ margin: 0px;
+}
+
+#popupContactClose {
+ font-size:14px;
+ line-height:14px;
+ right:6px;
+ top:4px;
+ position:absolute;
+ color:#6fa5fd;
+ font-weight:700;
+ display:block;
+}
+
+a.popupLink {
+ background: #FFF;
+ color: #0079C5;
+ font-family: "Comic Sans MS", sans-serif;
+ white-space: nowrap;
+ font-size: 14px;
+ font-weight: bold;
+
+ border-top: 2px solid #DDD;
+ border-left: 2px solid #DDD;
+ border-right: 2px solid #888;
+ border-bottom: 2px solid #888;
+ padding: 0px 1em 0px 1em;
+ margin: 0px 0px 3px 0px;
+}
+
+a.popupLink:hover {
+ background: #E0E0EF;
+ cursor: pointer;
+}
+
diff --git a/logback-site/src/site/pages/download.html b/logback-site/src/site/pages/download.html
index dc7bc51..6d5c460 100644
--- a/logback-site/src/site/pages/download.html
+++ b/logback-site/src/site/pages/download.html
@@ -8,15 +8,37 @@
<link rel="stylesheet" type="text/css" href="css/common.css" />
<link rel="stylesheet" type="text/css" href="css/screen.css" media="screen" />
<link rel="stylesheet" type="text/css" href="css/_print.css" media="print" />
+ <link rel="stylesheet" type="text/css" href="css/popup.css" media="screen" />
</head>
- <body>
- <script type="text/javascript">prefix='';</script>
+ <body onload="centerPopup(); loadPopup();">
+ <script type="text/javascript">prefix='';</script>
+
+ <script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.2.6.min.js" ></script>
+ <script type="text/javascript" src="js/jquery.cookies.2.2.0.js"></script>
+ <script type="text/javascript" src="js/popup.js" ></script>
<script src="templates/header.js" type="text/javascript"></script>
+
<div id="left">
<noscript>Please turn on Javascript to view this menu</noscript>
<script src="templates/left.js" type="text/javascript"></script>
</div>
+
+ <div id="popupContents">
+ <br/>
+ <h3>Would you like to participate in our one-question survey?</h3>
+
+ <br/>
+ <table width="100%">
+ <tr>
+ <td><a class="popupLink" id="announce">Yes, take me to the survey.</a></td>
+ <td><a class="popupLink" id="popupContentsClose">No, thanks.</a></td>
+ </tr>
+ </table>
+ </div>
+ <div id="backgroundPopup"></div>
+
+
<div id="content">
<h2>Download links</h2>
diff --git a/logback-site/src/site/pages/js/jquery.cookies.2.2.0.js b/logback-site/src/site/pages/js/jquery.cookies.2.2.0.js
new file mode 100644
index 0000000..c6dec07
--- /dev/null
+++ b/logback-site/src/site/pages/js/jquery.cookies.2.2.0.js
@@ -0,0 +1,450 @@
+/**
+ * Copyright (c) 2005 - 2010, James Auldridge
+ * All rights reserved.
+ *
+ * Licensed under the BSD, MIT, and GPL (your choice!) Licenses:
+ * http://code.google.com/p/cookies/wiki/License
+ *
+ */
+var jaaulde = window.jaaulde || {};
+jaaulde.utils = jaaulde.utils || {};
+jaaulde.utils.cookies = ( function()
+{
+ var resolveOptions, assembleOptionsString, parseCookies, constructor, defaultOptions = {
+ expiresAt: null,
+ path: '/',
+ domain: null,
+ secure: false
+ };
+ /**
+ * resolveOptions - receive an options object and ensure all options are present and valid, replacing with defaults where necessary
+ *
+ * @access private
+ * @static
+ * @parameter Object options - optional options to start with
+ * @return Object complete and valid options object
+ */
+ resolveOptions = function( options )
+ {
+ var returnValue, expireDate;
+
+ if( typeof options !== 'object' || options === null )
+ {
+ returnValue = defaultOptions;
+ }
+ else
+ {
+ returnValue = {
+ expiresAt: defaultOptions.expiresAt,
+ path: defaultOptions.path,
+ domain: defaultOptions.domain,
+ secure: defaultOptions.secure
+ };
+
+ if( typeof options.expiresAt === 'object' && options.expiresAt instanceof Date )
+ {
+ returnValue.expiresAt = options.expiresAt;
+ }
+ else if( typeof options.hoursToLive === 'number' && options.hoursToLive !== 0 )
+ {
+ expireDate = new Date();
+ expireDate.setTime( expireDate.getTime() + ( options.hoursToLive * 60 * 60 * 1000 ) );
+ returnValue.expiresAt = expireDate;
+ }
+
+ if( typeof options.path === 'string' && options.path !== '' )
+ {
+ returnValue.path = options.path;
+ }
+
+ if( typeof options.domain === 'string' && options.domain !== '' )
+ {
+ returnValue.domain = options.domain;
+ }
+
+ if( options.secure === true )
+ {
+ returnValue.secure = options.secure;
+ }
+ }
+
+ return returnValue;
+ };
+ /**
+ * assembleOptionsString - analyze options and assemble appropriate string for setting a cookie with those options
+ *
+ * @access private
+ * @static
+ * @parameter options OBJECT - optional options to start with
+ * @return STRING - complete and valid cookie setting options
+ */
+ assembleOptionsString = function( options )
+ {
+ options = resolveOptions( options );
+
+ return (
+ ( typeof options.expiresAt === 'object' && options.expiresAt instanceof Date ? '; expires=' + options.expiresAt.toGMTString() : '' ) +
+ '; path=' + options.path +
+ ( typeof options.domain === 'string' ? '; domain=' + options.domain : '' ) +
+ ( options.secure === true ? '; secure' : '' )
+ );
+ };
+ /**
+ * parseCookies - retrieve document.cookie string and break it into a hash with values decoded and unserialized
+ *
+ * @access private
+ * @static
+ * @return OBJECT - hash of cookies from document.cookie
+ */
+ parseCookies = function()
+ {
+ var cookies = {}, i, pair, name, value, separated = document.cookie.split( ';' ), unparsedValue;
+ for( i = 0; i < separated.length; i = i + 1 )
+ {
+ pair = separated[i].split( '=' );
+ name = pair[0].replace( /^\s*/, '' ).replace( /\s*$/, '' );
+
+ try
+ {
+ value = decodeURIComponent( pair[1] );
+ }
+ catch( e1 )
+ {
+ value = pair[1];
+ }
+
+ if( typeof JSON === 'object' && JSON !== null && typeof JSON.parse === 'function' )
+ {
+ try
+ {
+ unparsedValue = value;
+ value = JSON.parse( value );
+ }
+ catch( e2 )
+ {
+ value = unparsedValue;
+ }
+ }
+
+ cookies[name] = value;
+ }
+ return cookies;
+ };
+
+ constructor = function(){};
+
+ /**
+ * get - get one, several, or all cookies
+ *
+ * @access public
+ * @paramater Mixed cookieName - String:name of single cookie; Array:list of multiple cookie names; Void (no param):if you want all cookies
+ * @return Mixed - Value of cookie as set; Null:if only one cookie is requested and is not found; Object:hash of multiple or all cookies (if multiple or all requested);
+ */
+ constructor.prototype.get = function( cookieName )
+ {
+ var returnValue, item, cookies = parseCookies();
+
+ if( typeof cookieName === 'string' )
+ {
+ returnValue = ( typeof cookies[cookieName] !== 'undefined' ) ? cookies[cookieName] : null;
+ }
+ else if( typeof cookieName === 'object' && cookieName !== null )
+ {
+ returnValue = {};
+ for( item in cookieName )
+ {
+ if( typeof cookies[cookieName[item]] !== 'undefined' )
+ {
+ returnValue[cookieName[item]] = cookies[cookieName[item]];
+ }
+ else
+ {
+ returnValue[cookieName[item]] = null;
+ }
+ }
+ }
+ else
+ {
+ returnValue = cookies;
+ }
+
+ return returnValue;
+ };
+ /**
+ * filter - get array of cookies whose names match the provided RegExp
+ *
+ * @access public
+ * @paramater Object RegExp - The regular expression to match against cookie names
+ * @return Mixed - Object:hash of cookies whose names match the RegExp
+ */
+ constructor.prototype.filter = function( cookieNameRegExp )
+ {
+ var cookieName, returnValue = {}, cookies = parseCookies();
+
+ if( typeof cookieNameRegExp === 'string' )
+ {
+ cookieNameRegExp = new RegExp( cookieNameRegExp );
+ }
+
+ for( cookieName in cookies )
+ {
+ if( cookieName.match( cookieNameRegExp ) )
+ {
+ returnValue[cookieName] = cookies[cookieName];
+ }
+ }
+
+ return returnValue;
+ };
+ /**
+ * set - set or delete a cookie with desired options
+ *
+ * @access public
+ * @paramater String cookieName - name of cookie to set
+ * @paramater Mixed value - Any JS value. If not a string, will be JSON encoded; NULL to delete
+ * @paramater Object options - optional list of cookie options to specify
+ * @return void
+ */
+ constructor.prototype.set = function( cookieName, value, options )
+ {
+ if( typeof options !== 'object' || options === null )
+ {
+ options = {};
+ }
+
+ if( typeof value === 'undefined' || value === null )
+ {
+ value = '';
+ options.hoursToLive = -8760;
+ }
+
+ else if( typeof value !== 'string' )
+ {
+ if( typeof JSON === 'object' && JSON !== null && typeof JSON.stringify === 'function' )
+ {
+ value = JSON.stringify( value );
+ }
+ else
+ {
+ throw new Error( 'cookies.set() received non-string value and could not serialize.' );
+ }
+ }
+
+
+ var optionsString = assembleOptionsString( options );
+
+ document.cookie = cookieName + '=' + encodeURIComponent( value ) + optionsString;
+ };
+ /**
+ * del - delete a cookie (domain and path options must match those with which the cookie was set; this is really an alias for set() with parameters simplified for this use)
+ *
+ * @access public
+ * @paramater MIxed cookieName - String name of cookie to delete, or Bool true to delete all
+ * @paramater Object options - optional list of cookie options to specify ( path, domain )
+ * @return void
+ */
+ constructor.prototype.del = function( cookieName, options )
+ {
+ var allCookies = {}, name;
+
+ if( typeof options !== 'object' || options === null )
+ {
+ options = {};
+ }
+
+ if( typeof cookieName === 'boolean' && cookieName === true )
+ {
+ allCookies = this.get();
+ }
+ else if( typeof cookieName === 'string' )
+ {
+ allCookies[cookieName] = true;
+ }
+
+ for( name in allCookies )
+ {
+ if( typeof name === 'string' && name !== '' )
+ {
+ this.set( name, null, options );
+ }
+ }
+ };
+ /**
+ * test - test whether the browser is accepting cookies
+ *
+ * @access public
+ * @return Boolean
+ */
+ constructor.prototype.test = function()
+ {
+ var returnValue = false, testName = 'cT', testValue = 'data';
+
+ this.set( testName, testValue );
+
+ if( this.get( testName ) === testValue )
+ {
+ this.del( testName );
+ returnValue = true;
+ }
+
+ return returnValue;
+ };
+ /**
+ * setOptions - set default options for calls to cookie methods
+ *
+ * @access public
+ * @param Object options - list of cookie options to specify
+ * @return void
+ */
+ constructor.prototype.setOptions = function( options )
+ {
+ if( typeof options !== 'object' )
+ {
+ options = null;
+ }
+
+ defaultOptions = resolveOptions( options );
+ };
+
+ return new constructor();
+} )();
+
+( function()
+{
+ if( window.jQuery )
+ {
+ ( function( $ )
+ {
+ $.cookies = jaaulde.utils.cookies;
+
+ var extensions = {
+ /**
+ * $( 'selector' ).cookify - set the value of an input field, or the innerHTML of an element, to a cookie by the name or id of the field or element
+ * (field or element MUST have name or id attribute)
+ *
+ * @access public
+ * @param options OBJECT - list of cookie options to specify
+ * @return jQuery
+ */
+ cookify: function( options )
+ {
+ return this.each( function()
+ {
+ var i, nameAttrs = ['name', 'id'], name, $this = $( this ), value;
+
+ for( i in nameAttrs )
+ {
+ if( ! isNaN( i ) )
+ {
+ name = $this.attr( nameAttrs[ i ] );
+ if( typeof name === 'string' && name !== '' )
+ {
+ if( $this.is( ':checkbox, :radio' ) )
+ {
+ if( $this.attr( 'checked' ) )
+ {
+ value = $this.val();
+ }
+ }
+ else if( $this.is( ':input' ) )
+ {
+ value = $this.val();
+ }
+ else
+ {
+ value = $this.html();
+ }
+
+ if( typeof value !== 'string' || value === '' )
+ {
+ value = null;
+ }
+
+ $.cookies.set( name, value, options );
+
+ break;
+ }
+ }
+ }
+ } );
+ },
+ /**
+ * $( 'selector' ).cookieFill - set the value of an input field or the innerHTML of an element from a cookie by the name or id of the field or element
+ *
+ * @access public
+ * @return jQuery
+ */
+ cookieFill: function()
+ {
+ return this.each( function()
+ {
+ var n, getN, nameAttrs = ['name', 'id'], name, $this = $( this ), value;
+
+ getN = function()
+ {
+ n = nameAttrs.pop();
+ return !! n;
+ };
+
+ while( getN() )
+ {
+ name = $this.attr( n );
+ if( typeof name === 'string' && name !== '' )
+ {
+ value = $.cookies.get( name );
+ if( value !== null )
+ {
+ if( $this.is( ':checkbox, :radio' ) )
+ {
+ if( $this.val() === value )
+ {
+ $this.attr( 'checked', 'checked' );
+ }
+ else
+ {
+ $this.removeAttr( 'checked' );
+ }
+ }
+ else if( $this.is( ':input' ) )
+ {
+ $this.val( value );
+ }
+ else
+ {
+ $this.html( value );
+ }
+ }
+
+ break;
+ }
+ }
+ } );
+ },
+ /**
+ * $( 'selector' ).cookieBind - call cookie fill on matching elements, and bind their change events to cookify()
+ *
+ * @access public
+ * @param options OBJECT - list of cookie options to specify
+ * @return jQuery
+ */
+ cookieBind: function( options )
+ {
+ return this.each( function()
+ {
+ var $this = $( this );
+ $this.cookieFill().change( function()
+ {
+ $this.cookify( options );
+ } );
+ } );
+ }
+ };
+
+ $.each( extensions, function( i )
+ {
+ $.fn[i] = this;
+ } );
+
+ } )( window.jQuery );
+ }
+} )();
\ No newline at end of file
diff --git a/logback-site/src/site/pages/js/popup.js b/logback-site/src/site/pages/js/popup.js
new file mode 100644
index 0000000..e57d4b9
--- /dev/null
+++ b/logback-site/src/site/pages/js/popup.js
@@ -0,0 +1,102 @@
+/***************************/
+//@Author: Adrian "yEnS" Mato Gondelle
+//@website: www.yensdesign.com
+//@email: yensamg at gmail.com
+//@license: Feel free to use it, but keep this credits please!
+/***************************/
+
+//SETTING UP OUR POPUP
+//0 means disabled; 1 means enabled;
+var popupStatus = 0;
+
+//loading popup with jQuery magic!
+function loadPopup() {
+ var surveyCookie = $.cookies.get("SURVEY");
+ if(surveyCookie) {
+ popupStatus = 0;
+ return;
+ }
+ //loads popup only if it is disabled
+ if(popupStatus==0){
+ $("#backgroundPopup").css({
+ "opacity": "0.7"
+ });
+ $("#backgroundPopup").fadeIn("slow");
+ $("#popupContents").fadeIn("slow");
+ popupStatus = 1;
+ }
+}
+
+function getDateInSixMonths() {
+ var date = new Date();
+ date.setDate(date.getDate()+180);
+ return date;
+}
+
+//disabling popup with jQuery magic!
+function disablePopup(){
+ //disables popup only if it is enabled
+ if(popupStatus==1){
+ $("#backgroundPopup").fadeOut("slow");
+ $("#popupContents").fadeOut("slow");
+ popupStatus = 0;
+ $.cookies.set("SURVEY", "NO", {expiresAt: getDateInSixMonths()});
+ }
+}
+
+//centering popup
+function centerPopup(){
+ //request data for centering
+ var windowWidth = document.documentElement.clientWidth;
+ var windowHeight = document.documentElement.clientHeight;
+ var popupHeight = $("#popupContents").height();
+ var popupWidth = $("#popupContents").width();
+ //centering
+ $("#popupContents").css({
+ "position": "absolute",
+ "top": windowHeight/2-popupHeight/2,
+ "left": windowWidth/2-popupWidth/2
+ });
+ //only need force for IE6
+
+ $("#backgroundPopup").css({
+ "height": windowHeight
+ });
+
+}
+
+
+//CONTROLLING EVENTS IN jQuery
+$(document).ready(function(){
+
+ //LOADING POPUP
+ //Click the button event!
+ $("#button").click(function(){
+ //centering with css
+ centerPopup();
+ //load popup
+ loadPopup();
+ });
+
+ //CLOSING POPUP
+ //Click the x event!
+ $("#popupContentsClose").click(function(){
+ disablePopup();
+ });
+ //Click out event!
+ $("#backgroundPopup").click(function(){
+ //disablePopup();
+ });
+ //Press Escape event!
+ $(document).keypress(function(e){
+ if(e.keyCode==27 && popupStatus==1){
+ disablePopup();
+ }
+ });
+
+ $("#announce").click(function(){
+ $.cookies.set("SURVEY", "YES", {expiresAt: getDateInSixMonths()});
+ window.location='http://ceki.questionform.com/public/logbackDSL';
+ });
+});
+
diff --git a/logback-site/src/site/pages/reasonsToSwitch.html b/logback-site/src/site/pages/reasonsToSwitch.html
index 20c29bd..b12bf23 100644
--- a/logback-site/src/site/pages/reasonsToSwitch.html
+++ b/logback-site/src/site/pages/reasonsToSwitch.html
@@ -100,7 +100,7 @@
</p>
<h3><a name="conditional" href="#conditional">Conditional
- prcessing of configuration files</a></h3>
+ processing of configuration files</a></h3>
<p>Developers often need to juggle between several logback
configuration files targeting different environments such as
diff --git a/pom.xml b/pom.xml
index b804305..b77610a 100755
--- a/pom.xml
+++ b/pom.xml
@@ -1,11 +1,12 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-parent</artifactId>
- <version>0.9.21</version>
+ <version>0.9.22-SNAPSHOT</version>
<packaging>pom</packaging>
<name>Logback-Parent</name>
diff --git a/release.sh b/release.sh
index 1fa6637..44b5eb8 100644
--- a/release.sh
+++ b/release.sh
@@ -1,6 +1,6 @@
# memory aid
-mvn versions:set -DnewVersion=${VERSION_NUMBER}
+mvn versions:set -DnewVersion=${VERSION_NUMBER} -DgenerateBackupPoms=false
mvn clean
mvn install
-----------------------------------------------------------------------
Summary of changes:
logback-access/pom.xml | 2 +-
logback-classic/pom.xml | 2 +-
.../classic/gaffer/ConfigurationDelegate.groovy | 101 +++++
.../qos/logback/classic/gaffer/Configurator.groovy | 49 +++
.../logback/classic/gaffer/AppenderDelegate.groovy | 32 ++
.../gaffer/ConfigurationDelegateTest.groovy | 135 ++++++
logback-core/pom.xml | 20 +-
logback-examples/pom.xml | 2 +-
logback-site/pom.xml | 2 +-
logback-site/src/site/pages/codes.html | 84 +++--
logback-site/src/site/pages/css/popup.css | 67 +++
logback-site/src/site/pages/download.html | 26 +-
.../src/site/pages/js/jquery.cookies.2.2.0.js | 450 ++++++++++++++++++++
logback-site/src/site/pages/js/popup.js | 102 +++++
logback-site/src/site/pages/reasonsToSwitch.html | 2 +-
pom.xml | 5 +-
release.sh | 2 +-
17 files changed, 1044 insertions(+), 39 deletions(-)
create mode 100644 logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegate.groovy
create mode 100644 logback-classic/src/main/groovy/ch/qos/logback/classic/gaffer/Configurator.groovy
create mode 100644 logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/AppenderDelegate.groovy
create mode 100644 logback-classic/src/test/groovy/ch/qos/logback/classic/gaffer/ConfigurationDelegateTest.groovy
create mode 100644 logback-site/src/site/pages/css/popup.css
create mode 100644 logback-site/src/site/pages/js/jquery.cookies.2.2.0.js
create mode 100644 logback-site/src/site/pages/js/popup.js
hooks/post-receive
--
Logback: the generic, reliable, fast and flexible logging framework.
More information about the logback-dev
mailing list