You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by an...@apache.org on 2015/09/28 23:44:12 UTC

[1/9] tomee git commit: Rat

Repository: tomee
Updated Branches:
  refs/heads/tomee-7.0.0-M1 cb2a26ae8 -> bc6005a7d


Rat


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/8652068e
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/8652068e
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/8652068e

Branch: refs/heads/tomee-7.0.0-M1
Commit: 8652068e95d4d46c37daf49d64541835ed7e466b
Parents: 9376249
Author: andygumbrecht@apache.org <an...@gmx.de>
Authored: Fri Sep 25 18:26:13 2015 +0200
Committer: andygumbrecht@apache.org <an...@gmx.de>
Committed: Fri Sep 25 18:26:13 2015 +0200

----------------------------------------------------------------------
 .../jdbc/ResettableDataSourceHandlerTest.java      | 17 +++++++++++++++++
 rat.xml                                            |  1 +
 2 files changed, 18 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/8652068e/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/ResettableDataSourceHandlerTest.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/ResettableDataSourceHandlerTest.java b/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/ResettableDataSourceHandlerTest.java
index 8eeb5c5..78a43b2 100644
--- a/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/ResettableDataSourceHandlerTest.java
+++ b/container/openejb-core/src/test/java/org/apache/openejb/resource/jdbc/ResettableDataSourceHandlerTest.java
@@ -1,3 +1,20 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
 package org.apache.openejb.resource.jdbc;
 
 import org.apache.openejb.junit.ApplicationComposer;

http://git-wip-us.apache.org/repos/asf/tomee/blob/8652068e/rat.xml
----------------------------------------------------------------------
diff --git a/rat.xml b/rat.xml
index e273f2a..91f9d31 100644
--- a/rat.xml
+++ b/rat.xml
@@ -60,6 +60,7 @@
           <exclude name="tomee/tomee-deb/src/main/resources/control/control.template"/>
           <exclude name="tomee/tomee-deb/src/main/resources/copyright.template"/>
           <exclude name="tomee/tomee-webaccess/src/test/resources/test/log/**"/>
+          <exclude name="utils/log4j2-tomee/src/main/resources/META-INF/org.apache.openejb.extension"/>          
           <exclude name="utils/openejb-core-eclipselink/src/main/resources/META-INF/org.apache.openejb.persistence.PersistenceBootstrap.provider"/>
           <exclude name="utils/openejb-core-hibernate/src/main/resources/META-INF/org.apache.openejb.persistence.PersistenceBootstrap.provider"/>
           <exclude name="assembly/openejb-standalone/src/main/resources/service.readme.txt"/>


[9/9] tomee git commit: Merge branch 'master' into tomee-7.0.0-M1

Posted by an...@apache.org.
Merge branch 'master' into tomee-7.0.0-M1

Conflicts:
	pom.xml
	rat.xml
	tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/BackgroundTaskRunner.java
	tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Duration.java
	tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
	tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Size.java
	tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
	tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
	tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/PerfRunner.java


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/bc6005a7
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/bc6005a7
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/bc6005a7

Branch: refs/heads/tomee-7.0.0-M1
Commit: bc6005a7d7fa14893b81ee50cbfa0b72b91258a8
Parents: cb2a26a 5c743b5
Author: andygumbrecht@apache.org <an...@gmx.de>
Authored: Mon Sep 28 23:43:50 2015 +0200
Committer: andygumbrecht@apache.org <an...@gmx.de>
Committed: Mon Sep 28 23:43:50 2015 +0200

----------------------------------------------------------------------
 .../jul/formatter/AsyncConsoleHandler.java      | 125 +++----
 .../jul/formatter/SimpleTomEEFormatter.java     |  96 ++---
 .../tomee/jul/formatter/log/JULLogger.java      | 359 ++++++++++---------
 .../tomee/jul/formatter/log/ReloadableLog.java  | 232 ++++++------
 .../handler/rotating/BackgroundTaskRunner.java  |   2 +-
 .../tomee/jul/handler/rotating/Duration.java    | 158 +++++---
 .../jul/handler/rotating/LocalFileHandler.java  |  62 ++--
 .../apache/tomee/jul/handler/rotating/Size.java | 108 ++++--
 .../jul/formatter/SimpleTomEEFormatterTest.java | 161 +++++----
 .../jul/handler/rotating/ArchivingTest.java     |  15 +-
 .../handler/rotating/LocalFileHandlerTest.java  |   4 +-
 .../tomee/jul/handler/rotating/PerfRunner.java  |  14 +-
 12 files changed, 729 insertions(+), 607 deletions(-)
----------------------------------------------------------------------



[6/9] tomee git commit: PMD

Posted by an...@apache.org.
PMD


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/68119e24
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/68119e24
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/68119e24

Branch: refs/heads/tomee-7.0.0-M1
Commit: 68119e241914de48eca92e2be9c0731170e24388
Parents: 94b4a96
Author: andygumbrecht@apache.org <an...@gmx.de>
Authored: Mon Sep 28 23:15:12 2015 +0200
Committer: andygumbrecht@apache.org <an...@gmx.de>
Committed: Mon Sep 28 23:15:12 2015 +0200

----------------------------------------------------------------------
 .../jul/formatter/AsyncConsoleHandler.java      | 125 +++----
 .../jul/formatter/SimpleTomEEFormatter.java     |  96 ++---
 .../tomee/jul/formatter/log/JULLogger.java      | 359 ++++++++++---------
 .../tomee/jul/formatter/log/ReloadableLog.java  | 232 ++++++------
 .../handler/rotating/BackgroundTaskRunner.java  |   2 +-
 .../tomee/jul/handler/rotating/Duration.java    | 158 +++++---
 .../jul/handler/rotating/LocalFileHandler.java  |  58 +--
 .../apache/tomee/jul/handler/rotating/Size.java | 108 ++++--
 .../jul/formatter/SimpleTomEEFormatterTest.java | 161 +++++----
 .../jul/handler/rotating/ArchivingTest.java     |  10 +-
 .../handler/rotating/LocalFileHandlerTest.java  |   4 +-
 .../tomee/jul/handler/rotating/PerfRunner.java  |  14 +-
 12 files changed, 724 insertions(+), 603 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/AsyncConsoleHandler.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/AsyncConsoleHandler.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/AsyncConsoleHandler.java
index c6724c0..e212428 100644
--- a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/AsyncConsoleHandler.java
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/AsyncConsoleHandler.java
@@ -1,62 +1,63 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.jul.formatter;
-
-import org.apache.juli.AsyncFileHandler;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Formatter;
-import java.util.logging.LogRecord;
-
-public class AsyncConsoleHandler extends AsyncFileHandler {
-    private final ConsoleHandler delegate = new ConsoleHandler() {{
-        setFormatter(new SingleLineFormatter()); // console -> dev. File uses plain old format
-    }};
-
-    protected void publishInternal(final LogRecord record) {
-        delegate.publish(record);
-    }
-
-    // copy cause of classloading
-    private static class SingleLineFormatter extends Formatter {
-        private static final String SEP = System.getProperty("line.separator", "\n");
-
-        @Override
-        public synchronized String format(final LogRecord record) {
-            final boolean exception = record.getThrown() != null;
-            final StringBuilder sbuf = new StringBuilder();
-            sbuf.append(record.getLevel().getLocalizedName());
-            sbuf.append(" - ");
-            sbuf.append(this.formatMessage(record));
-            sbuf.append(SEP);
-            if (exception) {
-                try {
-                    final StringWriter sw = new StringWriter();
-                    final PrintWriter pw = new PrintWriter(sw);
-                    record.getThrown().printStackTrace(pw);
-                    pw.close();
-                    sbuf.append(sw.toString());
-                } catch (final Exception ex) {
-                    // no-op
-                }
-            }
-            return sbuf.toString();
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.formatter;
+
+import org.apache.juli.AsyncFileHandler;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Formatter;
+import java.util.logging.LogRecord;
+
+public class AsyncConsoleHandler extends AsyncFileHandler {
+    private final ConsoleHandler delegate = new ConsoleHandler() {{
+        setFormatter(new SingleLineFormatter()); // console -> dev. File uses plain old format
+    }};
+
+    protected void publishInternal(final LogRecord record) {
+        delegate.publish(record);
+    }
+
+    // copy cause of classloading
+    private static class SingleLineFormatter extends Formatter {
+        private static final String SEP = System.getProperty("line.separator", "\n");
+
+        @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+        @Override
+        public synchronized String format(final LogRecord record) {
+            final boolean exception = record.getThrown() != null;
+            final StringBuilder sbuf = new StringBuilder();
+            sbuf.append(record.getLevel().getLocalizedName());
+            sbuf.append(" - ");
+            sbuf.append(this.formatMessage(record));
+            sbuf.append(SEP);
+            if (exception) {
+                try {
+                    final StringWriter sw = new StringWriter();
+                    final PrintWriter pw = new PrintWriter(sw);
+                    record.getThrown().printStackTrace(pw);
+                    pw.close();
+                    sbuf.append(sw.toString());
+                } catch (final Exception ex) {
+                    // no-op
+                }
+            }
+            return sbuf.toString();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/SimpleTomEEFormatter.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/SimpleTomEEFormatter.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/SimpleTomEEFormatter.java
index 9c49445..5ee3a39 100644
--- a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/SimpleTomEEFormatter.java
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/SimpleTomEEFormatter.java
@@ -1,48 +1,48 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.tomee.jul.formatter;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.logging.LogRecord;
-
-public class SimpleTomEEFormatter extends java.util.logging.Formatter {
-    private static final String LN = System.getProperty("line.separator");
-
-    @Override
-    public synchronized String format(final LogRecord record) {
-        final Throwable thrown = record.getThrown();
-        final StringBuilder sbuf = new StringBuilder();
-        sbuf.append(record.getLevel().getLocalizedName());
-        sbuf.append(" - ");
-        sbuf.append(formatMessage(record));
-        sbuf.append(LN);
-        if (thrown != null) {
-            try {
-                final StringWriter sw = new StringWriter();
-                final PrintWriter pw = new PrintWriter(sw);
-                thrown.printStackTrace(pw);
-                pw.close();
-                sbuf.append(sw.toString());
-            } catch (final Exception ex) {
-                // no-op
-            }
-        }
-        return sbuf.toString();
-    }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.formatter;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.logging.LogRecord;
+
+public class SimpleTomEEFormatter extends java.util.logging.Formatter {
+    private static final String LN = System.getProperty("line.separator");
+
+    @SuppressWarnings("ThrowableResultOfMethodCallIgnored")
+    @Override
+    public synchronized String format(final LogRecord record) {
+        final Throwable thrown = record.getThrown();
+        final StringBuilder sbuf = new StringBuilder();
+        sbuf.append(record.getLevel().getLocalizedName());
+        sbuf.append(" - ");
+        sbuf.append(formatMessage(record));
+        sbuf.append(LN);
+        if (thrown != null) {
+            try {
+                final StringWriter sw = new StringWriter();
+                final PrintWriter pw = new PrintWriter(sw);
+                thrown.printStackTrace(pw);
+                pw.close();
+                sbuf.append(sw.toString());
+            } catch (final Exception ex) {
+                // no-op
+            }
+        }
+        return sbuf.toString();
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/JULLogger.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/JULLogger.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/JULLogger.java
index 4e7e938..39f8b4d 100644
--- a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/JULLogger.java
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/JULLogger.java
@@ -1,179 +1,180 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.jul.formatter.log;
-
-import org.apache.juli.logging.Log;
-
-import java.util.logging.ConsoleHandler;
-import java.util.logging.Formatter;
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-// DirectJDKLog copy since it is now package scoped
-public class JULLogger implements Log {
-    /** Alternate config reader and console format
-     */
-    private static final String SIMPLE_FMT="java.util.logging.SimpleFormatter";
-    private static final String SIMPLE_CFG="org.apache.juli.JdkLoggerConfig"; //doesn't exist
-    private static final String FORMATTER="org.apache.juli.formatter";
-
-    static {
-        if (System.getProperty("java.util.logging.config.class") == null  &&
-            System.getProperty("java.util.logging.config.file") == null) {
-            // default configuration - it sucks. Let's override at least the
-            // formatter for the console
-            try {
-                Class.forName(SIMPLE_CFG).newInstance();
-            } catch(final Throwable t) {
-                // no-op
-            }
-            try {
-                final Formatter fmt=(Formatter)Class.forName(System.getProperty(FORMATTER, SIMPLE_FMT)).newInstance();
-                // it is also possible that the user modified jre/lib/logging.properties -
-                // but that's really stupid in most cases
-                final Logger root=Logger.getLogger("");
-                final Handler[] handlers = root.getHandlers();
-                for( int i=0; i< handlers.length; i++ ) {
-                    // I only care about console - that's what's used in default config anyway
-                    if( handlers[i] instanceof ConsoleHandler) {
-                        handlers[i].setFormatter(fmt);
-                    }
-                }
-            } catch( Throwable t ) {
-                // no-op maybe it wasn't included - the ugly default will be used.
-            }
-        }
-    }
-
-    private final Logger logger;
-
-    public JULLogger(final String name ) {
-        logger= Logger.getLogger(name);
-    }
-
-    @Override
-    public final boolean isErrorEnabled() {
-        return logger.isLoggable(Level.SEVERE);
-    }
-
-    @Override
-    public final boolean isWarnEnabled() {
-        return logger.isLoggable(Level.WARNING);
-    }
-
-    @Override
-    public final boolean isInfoEnabled() {
-        return logger.isLoggable(Level.INFO);
-    }
-
-    @Override
-    public final boolean isDebugEnabled() {
-        return logger.isLoggable(Level.FINE);
-    }
-
-    @Override
-    public final boolean isFatalEnabled() {
-        return logger.isLoggable(Level.SEVERE);
-    }
-
-    @Override
-    public final boolean isTraceEnabled() {
-        return logger.isLoggable(Level.FINER);
-    }
-
-    @Override
-    public final void debug(final Object message) {
-        log(Level.FINE, String.valueOf(message), null);
-    }
-
-    @Override
-    public final void debug(final Object message, final Throwable t) {
-        log(Level.FINE, String.valueOf(message), t);
-    }
-
-    @Override
-    public final void trace(final Object message) {
-        log(Level.FINER, String.valueOf(message), null);
-    }
-
-    @Override
-    public final void trace(final Object message, final Throwable t) {
-        log(Level.FINER, String.valueOf(message), t);
-    }
-
-    @Override
-    public final void info(final Object message) {
-        log(Level.INFO, String.valueOf(message), null);
-    }
-
-    @Override
-    public final void info(final Object message, final Throwable t) {
-        log(Level.INFO, String.valueOf(message), t);
-    }
-
-    @Override
-    public final void warn(final Object message) {
-        log(Level.WARNING, String.valueOf(message), null);
-    }
-
-    @Override
-    public final void warn(final Object message, final Throwable t) {
-        log(Level.WARNING, String.valueOf(message), t);
-    }
-
-    @Override
-    public final void error(final Object message) {
-        log(Level.SEVERE, String.valueOf(message), null);
-    }
-
-    @Override
-    public final void error(final Object message, final Throwable t) {
-        log(Level.SEVERE, String.valueOf(message), t);
-    }
-
-    @Override
-    public final void fatal(final Object message) {
-        log(Level.SEVERE, String.valueOf(message), null);
-    }
-
-    @Override
-    public final void fatal(final Object message, final Throwable t) {
-        log(Level.SEVERE, String.valueOf(message), t);
-    }
-
-    private void log(final Level level, final String msg, final Throwable ex) {
-        if (logger.isLoggable(level)) {
-            // Hack (?) to get the stack trace.
-            final Throwable dummyException=new Throwable();
-            final StackTraceElement[] locations=dummyException.getStackTrace();
-            // Caller will be the third element
-            String cname = "unknown";
-            String method = "unknown";
-            if (locations != null && locations.length > 3) {
-                final StackTraceElement caller = locations[3];
-                cname = caller.getClassName();
-                method = caller.getMethodName();
-            }
-            if (ex==null) {
-                logger.logp(level, cname, method, msg);
-            } else {
-                logger.logp(level, cname, method, msg, ex);
-            }
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.formatter.log;
+
+import org.apache.juli.logging.Log;
+
+import java.util.logging.ConsoleHandler;
+import java.util.logging.Formatter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+// DirectJDKLog copy since it is now package scoped
+public class JULLogger implements Log {
+    /**
+     * Alternate config reader and console format
+     */
+    private static final String SIMPLE_FMT = "java.util.logging.SimpleFormatter";
+    private static final String SIMPLE_CFG = "org.apache.juli.JdkLoggerConfig"; //doesn't exist
+    private static final String FORMATTER = "org.apache.juli.formatter";
+
+    static {
+        if (System.getProperty("java.util.logging.config.class") == null &&
+                System.getProperty("java.util.logging.config.file") == null) {
+            // default configuration - it sucks. Let's override at least the
+            // formatter for the console
+            try {
+                Class.forName(SIMPLE_CFG).newInstance();
+            } catch (final Throwable t) {
+                // no-op
+            }
+            try {
+                final Formatter fmt = (Formatter) Class.forName(System.getProperty(FORMATTER, SIMPLE_FMT)).newInstance();
+                // it is also possible that the user modified jre/lib/logging.properties -
+                // but that's really stupid in most cases
+                final Logger root = Logger.getLogger("");
+                final Handler[] handlers = root.getHandlers();
+                for (final Handler handler : handlers) {
+                    // I only care about console - that's what's used in default config anyway
+                    if (handler instanceof ConsoleHandler) {
+                        handler.setFormatter(fmt);
+                    }
+                }
+            } catch (final Throwable t) {
+                // no-op maybe it wasn't included - the ugly default will be used.
+            }
+        }
+    }
+
+    private final Logger logger;
+
+    public JULLogger(final String name) {
+        logger = Logger.getLogger(name);
+    }
+
+    @Override
+    public final boolean isErrorEnabled() {
+        return logger.isLoggable(Level.SEVERE);
+    }
+
+    @Override
+    public final boolean isWarnEnabled() {
+        return logger.isLoggable(Level.WARNING);
+    }
+
+    @Override
+    public final boolean isInfoEnabled() {
+        return logger.isLoggable(Level.INFO);
+    }
+
+    @Override
+    public final boolean isDebugEnabled() {
+        return logger.isLoggable(Level.FINE);
+    }
+
+    @Override
+    public final boolean isFatalEnabled() {
+        return logger.isLoggable(Level.SEVERE);
+    }
+
+    @Override
+    public final boolean isTraceEnabled() {
+        return logger.isLoggable(Level.FINER);
+    }
+
+    @Override
+    public final void debug(final Object message) {
+        log(Level.FINE, String.valueOf(message), null);
+    }
+
+    @Override
+    public final void debug(final Object message, final Throwable t) {
+        log(Level.FINE, String.valueOf(message), t);
+    }
+
+    @Override
+    public final void trace(final Object message) {
+        log(Level.FINER, String.valueOf(message), null);
+    }
+
+    @Override
+    public final void trace(final Object message, final Throwable t) {
+        log(Level.FINER, String.valueOf(message), t);
+    }
+
+    @Override
+    public final void info(final Object message) {
+        log(Level.INFO, String.valueOf(message), null);
+    }
+
+    @Override
+    public final void info(final Object message, final Throwable t) {
+        log(Level.INFO, String.valueOf(message), t);
+    }
+
+    @Override
+    public final void warn(final Object message) {
+        log(Level.WARNING, String.valueOf(message), null);
+    }
+
+    @Override
+    public final void warn(final Object message, final Throwable t) {
+        log(Level.WARNING, String.valueOf(message), t);
+    }
+
+    @Override
+    public final void error(final Object message) {
+        log(Level.SEVERE, String.valueOf(message), null);
+    }
+
+    @Override
+    public final void error(final Object message, final Throwable t) {
+        log(Level.SEVERE, String.valueOf(message), t);
+    }
+
+    @Override
+    public final void fatal(final Object message) {
+        log(Level.SEVERE, String.valueOf(message), null);
+    }
+
+    @Override
+    public final void fatal(final Object message, final Throwable t) {
+        log(Level.SEVERE, String.valueOf(message), t);
+    }
+
+    private void log(final Level level, final String msg, final Throwable ex) {
+        if (logger.isLoggable(level)) {
+            // Hack (?) to get the stack trace.
+            final Throwable dummyException = new Throwable();
+            final StackTraceElement[] locations = dummyException.getStackTrace();
+            // Caller will be the third element
+            String cname = "unknown";
+            String method = "unknown";
+            if (locations != null && locations.length > 3) {
+                final StackTraceElement caller = locations[3];
+                cname = caller.getClassName();
+                method = caller.getMethodName();
+            }
+            if (ex == null) {
+                logger.logp(level, cname, method, msg);
+            } else {
+                logger.logp(level, cname, method, msg, ex);
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/ReloadableLog.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/ReloadableLog.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/ReloadableLog.java
index fecee67..fe274f8 100644
--- a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/ReloadableLog.java
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/formatter/log/ReloadableLog.java
@@ -1,116 +1,116 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.tomee.jul.formatter.log;
-
-import org.apache.juli.logging.Log;
-
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
-import java.util.concurrent.atomic.AtomicReference;
-
-public final class ReloadableLog {
-
-    public static final Class<?>[] INTERFACES = new Class<?>[]{Log.class};
-
-    private ReloadableLog() {
-        // no-op
-    }
-
-    public static Log newLog(final String name, final String factory) {
-        return Log.class.cast(Proxy.newProxyInstance(
-            ReloadableLog.class.getClassLoader(), INTERFACES, new ReloadableLogHandler(factory, name)));
-    }
-
-    private static final class ReloadableLogHandler implements InvocationHandler {
-        private static final String LOG4J_IMPL = "org.apache.tomee.loader.log.Log4jLog";
-        private static final String LOG4J2_IMPL = "org.apache.tomee.loader.log.Log4j2Log";
-        private static final String SLF4J_IMPL = "org.apache.tomee.loader.log.Slf4jLog";
-        private static final String MAVEN_IMPL = "org.apache.openejb.maven.util.TomEEMavenLog";
-
-        private volatile String factory;
-        private final String name;
-        private final AtomicReference<Log> delegate = new AtomicReference<>();
-        private volatile boolean done = false;
-
-        public ReloadableLogHandler(final String factory, final String name) {
-            this.factory = factory;
-            this.name = name;
-            initDelegate();
-        }
-
-        private Log initDelegate() {
-            if (done) {
-                return delegate.get();
-            }
-
-            try {
-                if (factory == null) {
-                    final String f = TomEELog.getLoggerClazz();
-                    if (f != null) {
-                        factory = f;
-                    }
-
-                    final Log log = delegate.get();
-                    if (factory == null && log != null) {
-                        return log;
-                    }
-                }
-                switch (factory) {
-                    case "org.apache.openejb.util.Log4jLogStreamFactory":
-                        delegate.set(newInstance(LOG4J_IMPL));
-                        break;
-                    case "org.apache.openejb.util.Log4j2LogStreamFactory":
-                        delegate.set(newInstance(LOG4J2_IMPL));
-                        break;
-                    case "org.apache.openejb.util.Slf4jLogStreamFactory":
-                        delegate.set(newInstance(SLF4J_IMPL));
-                        break;
-                    case "org.apache.openejb.maven.util.MavenLogStreamFactory":
-                        delegate.set(newInstance(MAVEN_IMPL));
-                        break;
-                    default:
-                        delegate.set(new JULLogger(name));
-                }
-                done = true;
-            } catch (final Throwable the) {
-                if (delegate.get() == null) {
-                    delegate.set(new JULLogger(name));
-                }
-            }
-            return delegate.get();
-        }
-
-        private Log newInstance(final String impl) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
-            return Log.class.cast(Thread.currentThread()
-                        .getContextClassLoader()
-                        .loadClass(impl)
-                        .getConstructor(String.class)
-                        .newInstance(name));
-        }
-
-        @Override
-        public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
-            try {
-                return method.invoke(initDelegate(), args);
-            } catch (final InvocationTargetException ite) {
-                throw ite.getCause();
-            }
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.formatter.log;
+
+import org.apache.juli.logging.Log;
+
+import java.lang.reflect.InvocationHandler;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Proxy;
+import java.util.concurrent.atomic.AtomicReference;
+
+public final class ReloadableLog {
+
+    public static final Class<?>[] INTERFACES = new Class<?>[]{Log.class};
+
+    private ReloadableLog() {
+        // no-op
+    }
+
+    public static Log newLog(final String name, final String factory) {
+        return Log.class.cast(Proxy.newProxyInstance(
+                ReloadableLog.class.getClassLoader(), INTERFACES, new ReloadableLogHandler(factory, name)));
+    }
+
+    private static final class ReloadableLogHandler implements InvocationHandler {
+        private static final String LOG4J_IMPL = "org.apache.tomee.loader.log.Log4jLog";
+        private static final String LOG4J2_IMPL = "org.apache.tomee.loader.log.Log4j2Log";
+        private static final String SLF4J_IMPL = "org.apache.tomee.loader.log.Slf4jLog";
+        private static final String MAVEN_IMPL = "org.apache.openejb.maven.util.TomEEMavenLog";
+
+        private volatile String factory;
+        private final String name;
+        private final AtomicReference<Log> delegate = new AtomicReference<>();
+        private volatile boolean done = false;
+
+        public ReloadableLogHandler(final String factory, final String name) {
+            this.factory = factory;
+            this.name = name;
+            initDelegate();
+        }
+
+        private Log initDelegate() {
+            if (done) {
+                return delegate.get();
+            }
+
+            try {
+                if (factory == null) {
+                    final String f = TomEELog.getLoggerClazz();
+                    if (f != null) {
+                        factory = f;
+                    }
+
+                    final Log log = delegate.get();
+                    if (factory == null && log != null) {
+                        return log;
+                    }
+                }
+                switch (factory) {
+                    case "org.apache.openejb.util.Log4jLogStreamFactory":
+                        delegate.set(newInstance(LOG4J_IMPL));
+                        break;
+                    case "org.apache.openejb.util.Log4j2LogStreamFactory":
+                        delegate.set(newInstance(LOG4J2_IMPL));
+                        break;
+                    case "org.apache.openejb.util.Slf4jLogStreamFactory":
+                        delegate.set(newInstance(SLF4J_IMPL));
+                        break;
+                    case "org.apache.openejb.maven.util.MavenLogStreamFactory":
+                        delegate.set(newInstance(MAVEN_IMPL));
+                        break;
+                    default:
+                        delegate.set(new JULLogger(name));
+                }
+                done = true;
+            } catch (final Throwable the) {
+                if (delegate.get() == null) {
+                    delegate.set(new JULLogger(name));
+                }
+            }
+            return delegate.get();
+        }
+
+        private Log newInstance(final String impl) throws InstantiationException, IllegalAccessException, InvocationTargetException, NoSuchMethodException, ClassNotFoundException {
+            return Log.class.cast(Thread.currentThread()
+                    .getContextClassLoader()
+                    .loadClass(impl)
+                    .getConstructor(String.class)
+                    .newInstance(name));
+        }
+
+        @Override
+        public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
+            try {
+                return method.invoke(initDelegate(), args);
+            } catch (final InvocationTargetException ite) {
+                throw ite.getCause();
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/BackgroundTaskRunner.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/BackgroundTaskRunner.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/BackgroundTaskRunner.java
index 5b88b5f..2b63ef0 100644
--- a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/BackgroundTaskRunner.java
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/BackgroundTaskRunner.java
@@ -45,7 +45,7 @@ class BackgroundTaskRunner {
                 private final String namePrefix = "com.tomitribe.logging.jul.handler.BackgroundTaskThread-";
 
                 {
-                    SecurityManager s = System.getSecurityManager();
+                    final SecurityManager s = System.getSecurityManager();
                     group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
                 }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Duration.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Duration.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Duration.java
index 005f43a..feac41f 100644
--- a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Duration.java
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Duration.java
@@ -100,10 +100,10 @@ class Duration {
         return unit.toMillis(time);
     }
 
-    private static class Normalize {
-        private long a;
-        private long b;
-        private TimeUnit base;
+    private static final class Normalize {
+        private final long a;
+        private final long b;
+        private final TimeUnit base;
 
         private Normalize(final Duration a, final Duration b) {
             this.base = lowest(a, b);
@@ -112,10 +112,18 @@ class Duration {
         }
 
         private static TimeUnit lowest(final Duration a, final Duration b) {
-            if (a.unit == null) return b.unit;
-            if (b.unit == null) return a.unit;
-            if (a.time == 0) return b.unit;
-            if (b.time == 0) return a.unit;
+            if (a.unit == null) {
+                return b.unit;
+            }
+            if (b.unit == null) {
+                return a.unit;
+            }
+            if (a.time == 0) {
+                return b.unit;
+            }
+            if (b.time == 0) {
+                return a.unit;
+            }
             return TimeUnit.values()[Math.min(a.unit.ordinal(), b.unit.ordinal())];
         }
     }
@@ -127,7 +135,7 @@ class Duration {
 
     private static void invalidFormat(final String text) {
         throw new IllegalArgumentException("Illegal duration format: '" + text +
-            "'.  Valid examples are '10s' or '10 seconds'.");
+                "'.  Valid examples are '10s' or '10 seconds'.");
     }
 
     private static TimeUnit parseUnit(final String u) {
@@ -135,42 +143,102 @@ class Duration {
             return null;
         }
 
-        if ("NANOSECONDS".equalsIgnoreCase(u)) return TimeUnit.NANOSECONDS;
-        if ("NANOSECOND".equalsIgnoreCase(u)) return TimeUnit.NANOSECONDS;
-        if ("NANOS".equalsIgnoreCase(u)) return TimeUnit.NANOSECONDS;
-        if ("NANO".equalsIgnoreCase(u)) return TimeUnit.NANOSECONDS;
-        if ("NS".equalsIgnoreCase(u)) return TimeUnit.NANOSECONDS;
-
-        if ("MICROSECONDS".equalsIgnoreCase(u)) return TimeUnit.MICROSECONDS;
-        if ("MICROSECOND".equalsIgnoreCase(u)) return TimeUnit.MICROSECONDS;
-        if ("MICROS".equalsIgnoreCase(u)) return TimeUnit.MICROSECONDS;
-        if ("MICRO".equalsIgnoreCase(u)) return TimeUnit.MICROSECONDS;
-
-        if ("MILLISECONDS".equalsIgnoreCase(u)) return TimeUnit.MILLISECONDS;
-        if ("MILLISECOND".equalsIgnoreCase(u)) return TimeUnit.MILLISECONDS;
-        if ("MILLIS".equalsIgnoreCase(u)) return TimeUnit.MILLISECONDS;
-        if ("MILLI".equalsIgnoreCase(u)) return TimeUnit.MILLISECONDS;
-        if ("MS".equalsIgnoreCase(u)) return TimeUnit.MILLISECONDS;
-
-        if ("SECONDS".equalsIgnoreCase(u)) return TimeUnit.SECONDS;
-        if ("SECOND".equalsIgnoreCase(u)) return TimeUnit.SECONDS;
-        if ("SEC".equalsIgnoreCase(u)) return TimeUnit.SECONDS;
-        if ("S".equalsIgnoreCase(u)) return TimeUnit.SECONDS;
-
-        if ("MINUTES".equalsIgnoreCase(u)) return TimeUnit.MINUTES;
-        if ("MINUTE".equalsIgnoreCase(u)) return TimeUnit.MINUTES;
-        if ("MIN".equalsIgnoreCase(u)) return TimeUnit.MINUTES;
-        if ("M".equalsIgnoreCase(u)) return TimeUnit.MINUTES;
-
-        if ("HOURS".equalsIgnoreCase(u)) return TimeUnit.HOURS;
-        if ("HOUR".equalsIgnoreCase(u)) return TimeUnit.HOURS;
-        if ("HRS".equalsIgnoreCase(u)) return TimeUnit.HOURS;
-        if ("HR".equalsIgnoreCase(u)) return TimeUnit.HOURS;
-        if ("H".equalsIgnoreCase(u)) return TimeUnit.HOURS;
-
-        if ("DAYS".equalsIgnoreCase(u)) return TimeUnit.DAYS;
-        if ("DAY".equalsIgnoreCase(u)) return TimeUnit.DAYS;
-        if ("D".equalsIgnoreCase(u)) return TimeUnit.DAYS;
+        if ("NANOSECONDS".equalsIgnoreCase(u)) {
+            return TimeUnit.NANOSECONDS;
+        }
+        if ("NANOSECOND".equalsIgnoreCase(u)) {
+            return TimeUnit.NANOSECONDS;
+        }
+        if ("NANOS".equalsIgnoreCase(u)) {
+            return TimeUnit.NANOSECONDS;
+        }
+        if ("NANO".equalsIgnoreCase(u)) {
+            return TimeUnit.NANOSECONDS;
+        }
+        if ("NS".equalsIgnoreCase(u)) {
+            return TimeUnit.NANOSECONDS;
+        }
+
+        if ("MICROSECONDS".equalsIgnoreCase(u)) {
+            return TimeUnit.MICROSECONDS;
+        }
+        if ("MICROSECOND".equalsIgnoreCase(u)) {
+            return TimeUnit.MICROSECONDS;
+        }
+        if ("MICROS".equalsIgnoreCase(u)) {
+            return TimeUnit.MICROSECONDS;
+        }
+        if ("MICRO".equalsIgnoreCase(u)) {
+            return TimeUnit.MICROSECONDS;
+        }
+
+        if ("MILLISECONDS".equalsIgnoreCase(u)) {
+            return TimeUnit.MILLISECONDS;
+        }
+        if ("MILLISECOND".equalsIgnoreCase(u)) {
+            return TimeUnit.MILLISECONDS;
+        }
+        if ("MILLIS".equalsIgnoreCase(u)) {
+            return TimeUnit.MILLISECONDS;
+        }
+        if ("MILLI".equalsIgnoreCase(u)) {
+            return TimeUnit.MILLISECONDS;
+        }
+        if ("MS".equalsIgnoreCase(u)) {
+            return TimeUnit.MILLISECONDS;
+        }
+
+        if ("SECONDS".equalsIgnoreCase(u)) {
+            return TimeUnit.SECONDS;
+        }
+        if ("SECOND".equalsIgnoreCase(u)) {
+            return TimeUnit.SECONDS;
+        }
+        if ("SEC".equalsIgnoreCase(u)) {
+            return TimeUnit.SECONDS;
+        }
+        if ("S".equalsIgnoreCase(u)) {
+            return TimeUnit.SECONDS;
+        }
+
+        if ("MINUTES".equalsIgnoreCase(u)) {
+            return TimeUnit.MINUTES;
+        }
+        if ("MINUTE".equalsIgnoreCase(u)) {
+            return TimeUnit.MINUTES;
+        }
+        if ("MIN".equalsIgnoreCase(u)) {
+            return TimeUnit.MINUTES;
+        }
+        if ("M".equalsIgnoreCase(u)) {
+            return TimeUnit.MINUTES;
+        }
+
+        if ("HOURS".equalsIgnoreCase(u)) {
+            return TimeUnit.HOURS;
+        }
+        if ("HOUR".equalsIgnoreCase(u)) {
+            return TimeUnit.HOURS;
+        }
+        if ("HRS".equalsIgnoreCase(u)) {
+            return TimeUnit.HOURS;
+        }
+        if ("HR".equalsIgnoreCase(u)) {
+            return TimeUnit.HOURS;
+        }
+        if ("H".equalsIgnoreCase(u)) {
+            return TimeUnit.HOURS;
+        }
+
+        if ("DAYS".equalsIgnoreCase(u)) {
+            return TimeUnit.DAYS;
+        }
+        if ("DAY".equalsIgnoreCase(u)) {
+            return TimeUnit.DAYS;
+        }
+        if ("D".equalsIgnoreCase(u)) {
+            return TimeUnit.DAYS;
+        }
 
         throw new IllegalArgumentException("Unknown time unit '" + u + "'");
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
index 7656063..a3471e4 100644
--- a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
@@ -50,27 +50,27 @@ import java.util.zip.ZipEntry;
 import java.util.zip.ZipOutputStream;
 
 /**
- *  NOTE: for simplicity the prefix `org.apache.tomee.jul.handler.rotating.LocalFileHandler.` has been removed of name columns.
- *
- *  |===
- *  | Name                      | Default Value                                     | Description
- *  | filenamePattern           | ${catalina.base}/logs/logs.%s.%03d.log            | where log files are created, it uses String.format() and gives you the date and file number - in this order.
- *  | limit                     | 10 Megabytes                                      | limit size indicating the file should be rotated
- *  | dateCheckInterval         | 5 seconds                                         | how often the date should be computed to rotate the file (don't do it each time for performances reason, means you can get few records of next day in a file name with current day)
- *  | bufferSize                | -1 bytes                                          | if positive the in memory buffer used to store data before flushing them to the disk
- *  | encoding                  | -                                                 | file encoding
- *  | level                     | ALL                                               | level this handler accepts
- *  | filter                    | -                                                 | filter used to check if the message should be logged
- *  | formatter                 | java.util.logging.SimpleFormatter                 | formatter used to format messages
- *  | archiveDirectory          | ${catalina.base}/logs/archives/                   | where compressed logs are put.
- *  | archiveFormat             | gzip                                              | zip or gzip.
- *  | archiveOlderThan          | -1 days                                           | how many days files are kept before being compressed
- *  | purgeOlderThan            | -1 days                                           | how many days files are kept before being deleted, note: it applies on archives and not log files so 2 days of archiving and 3 days of purge makes it deleted after 5 days.
- *  | compressionLevel          | -1                                                | In case of zip archiving the zip compression level (-1 for off or 0-9).
- *  |===
- *
- *  NOTE: archiving and purging are done only when a file is rotated, it means it can be ignored during days if there is no logging activity.
- *
+ * NOTE: for simplicity the prefix `org.apache.tomee.jul.handler.rotating.LocalFileHandler.` has been removed of name columns.
+ * <p/>
+ * |===
+ * | Name                      | Default Value                                     | Description
+ * | filenamePattern           | ${catalina.base}/logs/logs.%s.%03d.log            | where log files are created, it uses String.format() and gives you the date and file number - in this order.
+ * | limit                     | 10 Megabytes                                      | limit size indicating the file should be rotated
+ * | dateCheckInterval         | 5 seconds                                         | how often the date should be computed to rotate the file (don't do it each time for performances reason, means you can get few records of next day in a file name with current day)
+ * | bufferSize                | -1 bytes                                          | if positive the in memory buffer used to store data before flushing them to the disk
+ * | encoding                  | -                                                 | file encoding
+ * | level                     | ALL                                               | level this handler accepts
+ * | filter                    | -                                                 | filter used to check if the message should be logged
+ * | formatter                 | java.util.logging.SimpleFormatter                 | formatter used to format messages
+ * | archiveDirectory          | ${catalina.base}/logs/archives/                   | where compressed logs are put.
+ * | archiveFormat             | gzip                                              | zip or gzip.
+ * | archiveOlderThan          | -1 days                                           | how many days files are kept before being compressed
+ * | purgeOlderThan            | -1 days                                           | how many days files are kept before being deleted, note: it applies on archives and not log files so 2 days of archiving and 3 days of purge makes it deleted after 5 days.
+ * | compressionLevel          | -1                                                | In case of zip archiving the zip compression level (-1 for off or 0-9).
+ * |===
+ * <p/>
+ * NOTE: archiving and purging are done only when a file is rotated, it means it can be ignored during days if there is no logging activity.
+ * <p/>
  * NOTE: archiving and purging is done in a background thread pool, you can configure the number of threads in thanks to
  * `org.apache.tomee.jul.handler.rotating.BackgroundTaskRunner.threads` property in `conf/logging.properties`.
  * Default is 2 which should be fine for most applications.
@@ -207,7 +207,7 @@ public class LocalFileHandler extends Handler {
             writerLock.readLock().lock();
             rotateIfNeeded(tsDate);
 
-            String result;
+            final String result;
             try {
                 result = getFormatter().format(record);
             } catch (final Exception e) {
@@ -392,12 +392,12 @@ public class LocalFileHandler extends Handler {
         }
         if (archiveExpiryDuration > 0) { // archiving log files
             final File[] logs = new File(formatFilename(filenamePattern, "0000-00-00", 0)).getParentFile()
-                .listFiles(new FilenameFilter() {
-                    @Override
-                    public boolean accept(final File dir, final String name) {
-                        return filenameRegex.matcher(name).matches();
-                    }
-                });
+                    .listFiles(new FilenameFilter() {
+                        @Override
+                        public boolean accept(final File dir, final String name) {
+                            return filenameRegex.matcher(name).matches();
+                        }
+                    });
 
             if (logs != null) {
                 for (final File file : logs) {
@@ -514,7 +514,7 @@ public class LocalFileHandler extends Handler {
         return result;
     }
 
-    private class CountingStream extends OutputStream {
+    private final class CountingStream extends OutputStream {
         private final OutputStream out;
 
         private CountingStream(final OutputStream out) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Size.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Size.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Size.java
index be1b476..a7d9844 100644
--- a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Size.java
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Size.java
@@ -111,10 +111,10 @@ class Size {
         return unit.toBytes(size);
     }
 
-    private static class Normalize {
-        private long a;
-        private long b;
-        private SizeUnit base;
+    private static final class Normalize {
+        private final long a;
+        private final long b;
+        private final SizeUnit base;
 
         private Normalize(final Size a, final Size b) {
             this.base = lowest(a, b);
@@ -123,10 +123,18 @@ class Size {
         }
 
         private static SizeUnit lowest(final Size a, final Size b) {
-            if (a.unit == null) return b.unit;
-            if (b.unit == null) return a.unit;
-            if (a.size == 0) return b.unit;
-            if (b.size == 0) return a.unit;
+            if (a.unit == null) {
+                return b.unit;
+            }
+            if (b.unit == null) {
+                return a.unit;
+            }
+            if (a.size == 0) {
+                return b.unit;
+            }
+            if (b.size == 0) {
+                return a.unit;
+            }
             return SizeUnit.values()[Math.min(a.unit.ordinal(), b.unit.ordinal())];
         }
     }
@@ -141,29 +149,67 @@ class Size {
     }
 
     private static SizeUnit parseUnit(final String u) {
-        if (u.length() == 0) return null;
-
-        if ("BYTES".equalsIgnoreCase(u)) return SizeUnit.BYTES;
-        if ("BYTE".equalsIgnoreCase(u)) return SizeUnit.BYTES;
-        if ("B".equalsIgnoreCase(u)) return SizeUnit.BYTES;
-
-        if ("KILOBYTES".equalsIgnoreCase(u)) return SizeUnit.KILOBYTES;
-        if ("KILOBYTE".equalsIgnoreCase(u)) return SizeUnit.KILOBYTES;
-        if ("KILO".equalsIgnoreCase(u)) return SizeUnit.KILOBYTES;
-        if ("KB".equalsIgnoreCase(u)) return SizeUnit.KILOBYTES;
-        if ("K".equalsIgnoreCase(u)) return SizeUnit.KILOBYTES;
-
-        if ("MEGABYTES".equalsIgnoreCase(u)) return SizeUnit.MEGABYTES;
-        if ("MEGABYTE".equalsIgnoreCase(u)) return SizeUnit.MEGABYTES;
-        if ("MEGA".equalsIgnoreCase(u)) return SizeUnit.MEGABYTES;
-        if ("MB".equalsIgnoreCase(u)) return SizeUnit.MEGABYTES;
-        if ("M".equalsIgnoreCase(u)) return SizeUnit.MEGABYTES;
-
-        if ("GIGABYTES".equalsIgnoreCase(u)) return SizeUnit.GIGABYTES;
-        if ("GIGABYTE".equalsIgnoreCase(u)) return SizeUnit.GIGABYTES;
-        if ("GIGA".equalsIgnoreCase(u)) return SizeUnit.GIGABYTES;
-        if ("GB".equalsIgnoreCase(u)) return SizeUnit.GIGABYTES;
-        if ("G".equalsIgnoreCase(u)) return SizeUnit.GIGABYTES;
+        if (u.length() == 0) {
+            return null;
+        }
+
+        if ("BYTES".equalsIgnoreCase(u)) {
+            return SizeUnit.BYTES;
+        }
+        if ("BYTE".equalsIgnoreCase(u)) {
+            return SizeUnit.BYTES;
+        }
+        if ("B".equalsIgnoreCase(u)) {
+            return SizeUnit.BYTES;
+        }
+
+        if ("KILOBYTES".equalsIgnoreCase(u)) {
+            return SizeUnit.KILOBYTES;
+        }
+        if ("KILOBYTE".equalsIgnoreCase(u)) {
+            return SizeUnit.KILOBYTES;
+        }
+        if ("KILO".equalsIgnoreCase(u)) {
+            return SizeUnit.KILOBYTES;
+        }
+        if ("KB".equalsIgnoreCase(u)) {
+            return SizeUnit.KILOBYTES;
+        }
+        if ("K".equalsIgnoreCase(u)) {
+            return SizeUnit.KILOBYTES;
+        }
+
+        if ("MEGABYTES".equalsIgnoreCase(u)) {
+            return SizeUnit.MEGABYTES;
+        }
+        if ("MEGABYTE".equalsIgnoreCase(u)) {
+            return SizeUnit.MEGABYTES;
+        }
+        if ("MEGA".equalsIgnoreCase(u)) {
+            return SizeUnit.MEGABYTES;
+        }
+        if ("MB".equalsIgnoreCase(u)) {
+            return SizeUnit.MEGABYTES;
+        }
+        if ("M".equalsIgnoreCase(u)) {
+            return SizeUnit.MEGABYTES;
+        }
+
+        if ("GIGABYTES".equalsIgnoreCase(u)) {
+            return SizeUnit.GIGABYTES;
+        }
+        if ("GIGABYTE".equalsIgnoreCase(u)) {
+            return SizeUnit.GIGABYTES;
+        }
+        if ("GIGA".equalsIgnoreCase(u)) {
+            return SizeUnit.GIGABYTES;
+        }
+        if ("GB".equalsIgnoreCase(u)) {
+            return SizeUnit.GIGABYTES;
+        }
+        if ("G".equalsIgnoreCase(u)) {
+            return SizeUnit.GIGABYTES;
+        }
 
         throw new IllegalArgumentException("Unknown size unit '" + u + "'");
     }

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/formatter/SimpleTomEEFormatterTest.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/formatter/SimpleTomEEFormatterTest.java b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/formatter/SimpleTomEEFormatterTest.java
index 9a2fccd..91ff914 100644
--- a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/formatter/SimpleTomEEFormatterTest.java
+++ b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/formatter/SimpleTomEEFormatterTest.java
@@ -1,81 +1,80 @@
-/**
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- */
-package org.apache.tomee.jul.formatter;
-
-import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.junit.Test;
-
-import java.util.logging.Formatter;
-import java.util.logging.Level;
-import java.util.logging.LogRecord;
-
-import static org.junit.Assert.assertEquals;
-
-public class SimpleTomEEFormatterTest {
-    private static final String LINE_SEPARATOR_KEY = "line.separator";
-
-    @Test
-    public void formatNullThrown() throws Exception {
-        final String previousLineSeparatorProperty = System.getProperty(LINE_SEPARATOR_KEY);
-        try {
-            final String lineSeparatorValue = "\n";
-            final String logMessage = "An example log record";
-            final Level level = Level.FINEST;
-
-            System.setProperty(LINE_SEPARATOR_KEY, lineSeparatorValue);
-            final LogRecord logRecordInput = new LogRecord(level, logMessage);
-            logRecordInput.setThrown(null);
-
-            final Formatter formatter = new SimpleTomEEFormatter();
-            final String actualFormatOutput = formatter.format(logRecordInput);
-
-            final String expectedFormatOutput = level.getLocalizedName() + " - " + logMessage + "\n";
-
-            assertEquals(expectedFormatOutput, actualFormatOutput);
-        } finally {
-            System.setProperty(LINE_SEPARATOR_KEY, previousLineSeparatorProperty);
-        }
-    }
-
-    @Test
-    public void formatNotNullThrown() throws Exception {
-        final String previousLineSeparatorProperty = System.getProperty(LINE_SEPARATOR_KEY);
-
-        try {
-            final String lineSeparatorValue = "\n";
-            final String logMessage = "An example log record";
-            final Level level = Level.CONFIG;
-            final String exceptionMessage = "An example exception";
-            final Throwable thrown = new Exception(exceptionMessage);
-
-            System.setProperty(LINE_SEPARATOR_KEY, lineSeparatorValue);
-            final LogRecord logRecordInput = new LogRecord(level, logMessage);
-            logRecordInput.setThrown(thrown);
-
-            final Formatter formatter = new SimpleTomEEFormatter();
-            final String actualFormatOutput = formatter.format(logRecordInput);
-
-            final String expectedFormatOutput = level.getLocalizedName() + " - " + logMessage + lineSeparatorValue + ExceptionUtils.getStackTrace(thrown);
-
-            assertEquals(expectedFormatOutput, actualFormatOutput);
-        } finally {
-            System.setProperty(LINE_SEPARATOR_KEY, previousLineSeparatorProperty);
-        }
-    }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.formatter;
+
+import org.apache.commons.lang3.exception.ExceptionUtils;
+import org.junit.Test;
+
+import java.util.logging.Formatter;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+import static org.junit.Assert.assertEquals;
+
+public class SimpleTomEEFormatterTest {
+    private static final String LINE_SEPARATOR_KEY = "line.separator";
+
+    @Test
+    public void formatNullThrown() throws Exception {
+        final String previousLineSeparatorProperty = System.getProperty(LINE_SEPARATOR_KEY);
+        try {
+            final String lineSeparatorValue = "\n";
+            final String logMessage = "An example log record";
+            final Level level = Level.FINEST;
+
+            System.setProperty(LINE_SEPARATOR_KEY, lineSeparatorValue);
+            final LogRecord logRecordInput = new LogRecord(level, logMessage);
+            logRecordInput.setThrown(null);
+
+            final Formatter formatter = new SimpleTomEEFormatter();
+            final String actualFormatOutput = formatter.format(logRecordInput);
+
+            final String expectedFormatOutput = level.getLocalizedName() + " - " + logMessage + "\n";
+
+            assertEquals(expectedFormatOutput, actualFormatOutput);
+        } finally {
+            System.setProperty(LINE_SEPARATOR_KEY, previousLineSeparatorProperty);
+        }
+    }
+
+    @Test
+    public void formatNotNullThrown() throws Exception {
+        final String previousLineSeparatorProperty = System.getProperty(LINE_SEPARATOR_KEY);
+
+        try {
+            final String lineSeparatorValue = "\n";
+            final String logMessage = "An example log record";
+            final Level level = Level.CONFIG;
+            final String exceptionMessage = "An example exception";
+            final Throwable thrown = new Exception(exceptionMessage);
+
+            System.setProperty(LINE_SEPARATOR_KEY, lineSeparatorValue);
+            final LogRecord logRecordInput = new LogRecord(level, logMessage);
+            logRecordInput.setThrown(thrown);
+
+            final Formatter formatter = new SimpleTomEEFormatter();
+            final String actualFormatOutput = formatter.format(logRecordInput);
+
+            final String expectedFormatOutput = level.getLocalizedName() + " - " + logMessage + lineSeparatorValue + ExceptionUtils.getStackTrace(thrown);
+
+            assertEquals(expectedFormatOutput, actualFormatOutput);
+        } finally {
+            System.setProperty(LINE_SEPARATOR_KEY, previousLineSeparatorProperty);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
index 77da90b..ea78857 100644
--- a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
+++ b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
@@ -43,7 +43,7 @@ import static org.junit.Assert.assertTrue;
 public class ArchivingTest {
     @Parameterized.Parameters(name = "{0}")
     public static String[][] formats() {
-        return new String[][] { { "zip" }, { "gzip" } };
+        return new String[][]{{"zip"}, {"gzip"}};
     }
 
     @Parameterized.Parameter(0)
@@ -194,7 +194,9 @@ public class ArchivingTest {
                         return pathname.getName().startsWith("test");
                     }
                 }))) {
-                    file.delete();
+                    if (!file.delete()) {
+                        file.deleteOnExit();
+                    }
                 }
             }
         }
@@ -207,7 +209,9 @@ public class ArchivingTest {
                         return pathname.getName().startsWith("test");
                     }
                 }))) {
-                    file.delete();
+                    if (!file.delete()) {
+                        file.deleteOnExit();
+                    }
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
index e17740d..2af3675 100644
--- a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
+++ b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
@@ -50,7 +50,9 @@ public class LocalFileHandlerTest {
                     return pathname.getName().startsWith("test");
                 }
             }))) {
-                file.delete();
+                if(!file.delete()){
+                    file.deleteOnExit();
+                }
             }
         }
 

http://git-wip-us.apache.org/repos/asf/tomee/blob/68119e24/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/PerfRunner.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/PerfRunner.java b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/PerfRunner.java
index 8ef6644..c4fd956 100644
--- a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/PerfRunner.java
+++ b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/PerfRunner.java
@@ -98,12 +98,12 @@ public class PerfRunner {
 
     public static void main(final String[] args) throws RunnerException {
         new Runner(new OptionsBuilder()
-            .include(PerfRunner.class.getSimpleName())
-            .forks(0)
-            .warmupIterations(5)
-            .measurementIterations(5)
-            .threads(1)
-            .build())
-            .run();
+                .include(PerfRunner.class.getSimpleName())
+                .forks(0)
+                .warmupIterations(5)
+                .measurementIterations(5)
+                .threads(1)
+                .build())
+                .run();
     }
 }


[7/9] tomee git commit: Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tomee

Posted by an...@apache.org.
Merge branch 'master' of https://git-wip-us.apache.org/repos/asf/tomee


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/4f2c20b9
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/4f2c20b9
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/4f2c20b9

Branch: refs/heads/tomee-7.0.0-M1
Commit: 4f2c20b9172ee435514e7478d23047463b9cb8e5
Parents: 68119e2 b200261
Author: andygumbrecht@apache.org <an...@gmx.de>
Authored: Mon Sep 28 23:15:50 2015 +0200
Committer: andygumbrecht@apache.org <an...@gmx.de>
Committed: Mon Sep 28 23:15:50 2015 +0200

----------------------------------------------------------------------
 .../org/apache/tomee/jul/handler/rotating/ArchivingTest.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/4f2c20b9/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
----------------------------------------------------------------------


[8/9] tomee git commit: Java7

Posted by an...@apache.org.
Java7


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/5c743b50
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/5c743b50
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/5c743b50

Branch: refs/heads/tomee-7.0.0-M1
Commit: 5c743b5068e247ee7023deaebb17fb0953cd80fa
Parents: 4f2c20b
Author: andygumbrecht@apache.org <an...@gmx.de>
Authored: Mon Sep 28 23:35:23 2015 +0200
Committer: andygumbrecht@apache.org <an...@gmx.de>
Committed: Mon Sep 28 23:35:23 2015 +0200

----------------------------------------------------------------------
 .../org/apache/tomee/jul/handler/rotating/LocalFileHandler.java  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/5c743b50/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
index a3471e4..b662b6d 100644
--- a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
@@ -529,13 +529,13 @@ public class LocalFileHandler extends Handler {
         }
 
         @Override
-        public void write(final byte buff[]) throws IOException {
+        public void write(final byte[] buff) throws IOException {
             out.write(buff);
             written += buff.length;
         }
 
         @Override
-        public void write(final byte buff[], final int off, final int len) throws IOException {
+        public void write(final byte[] buff, final int off, final int len) throws IOException {
             out.write(buff, off, len);
             written += len;
         }


[4/9] tomee git commit: TOMEE-1632 dont hide IOException in Client

Posted by an...@apache.org.
TOMEE-1632 dont hide IOException in Client


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/94b4a96f
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/94b4a96f
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/94b4a96f

Branch: refs/heads/tomee-7.0.0-M1
Commit: 94b4a96f4dca812e6e1cc8186cc06f6ad15725db
Parents: 96bcc48
Author: Romain Manni-Bucau <rm...@gmail.com>
Authored: Sun Sep 27 08:19:21 2015 -0700
Committer: Romain Manni-Bucau <rm...@gmail.com>
Committed: Sun Sep 27 08:19:21 2015 -0700

----------------------------------------------------------------------
 .../src/main/java/org/apache/openejb/client/Client.java      | 8 ++++----
 .../test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java  | 3 +--
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/94b4a96f/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java
----------------------------------------------------------------------
diff --git a/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java b/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java
index 2834f2e..837a2ea 100644
--- a/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java
+++ b/server/openejb-client/src/main/java/org/apache/openejb/client/Client.java
@@ -50,17 +50,15 @@ import static org.apache.openejb.client.Exceptions.newIOException;
 
 public class Client {
 
-    public static final String OPENEJB_CLIENT_RETRY_CONDITION_MAX = "openejb.client.retry.condition.max";
     private static final String OPENEJB_CLIENT_COMPATIBILITY_VERSION = "openejb.client.protocol.version";
 
     private static final Logger logger = Logger.getLogger("OpenEJB.client");
     private boolean FINEST = logger.isLoggable(Level.FINEST);
     private boolean FINER = logger.isLoggable(Level.FINER);
 
-    public static final ThreadLocal<Set<URI>> failed = new ThreadLocal<Set<URI>>();
+    public static final ThreadLocal<Set<URI>> failed = new ThreadLocal<>();
     private static final ProtocolMetaData PROTOCOL_META_DATA = new ProtocolMetaData();
 
-    private static final int maxConditionRetry = Integer.parseInt(System.getProperty(OPENEJB_CLIENT_RETRY_CONDITION_MAX, "20"));
     private static Client client = new Client();
     private static final ProtocolMetaData COMPATIBLE_META_DATA;
 
@@ -69,7 +67,7 @@ public class Client {
         COMPATIBLE_META_DATA = (null != version ? new ProtocolMetaData(version) : null);
     }
 
-    private List<Class<? extends Throwable>> retryConditions = new CopyOnWriteArrayList<Class<? extends Throwable>>();
+    private List<Class<? extends Throwable>> retryConditions = new CopyOnWriteArrayList<>();
     private boolean retry = false;
 
     private final Observers observers = new Observers();
@@ -389,6 +387,8 @@ public class Client {
                     }
                     throw new RemoteFailoverException("Cannot complete request.  Retry attempted on " + failed.size() + " servers", e);
                 }
+            } else {
+                throw new RemoteException("Cannot read the response from the server (" + protocolRequest.getSpec() + ") : " + e.getMessage(), e);
             }
 
         } catch (final Throwable error) {

http://git-wip-us.apache.org/repos/asf/tomee/blob/94b4a96f/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java
----------------------------------------------------------------------
diff --git a/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java b/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java
index 5852661..8c0fb7b 100644
--- a/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java
+++ b/server/openejb-ejbd/src/test/java/org/apache/openejb/server/ejbd/ZEjbdTest.java
@@ -16,7 +16,6 @@
  */
 package org.apache.openejb.server.ejbd;
 
-import org.apache.openejb.client.ClientRuntimeException;
 import org.apache.openejb.client.RemoteInitialContextFactory;
 import org.apache.openejb.jee.EnterpriseBean;
 import org.apache.openejb.jee.SingletonBean;
@@ -77,7 +76,7 @@ public class ZEjbdTest {
         remoteCall("zejbd");
     }
 
-    @Test(expected = ClientRuntimeException.class)
+    @Test(expected = NamingException.class)
     public void checkEjbdFailWithAGzipServer() throws Exception {
         remoteCall("ejbd");
     }


[3/9] tomee git commit: jcs beta-1 doesnt work for us

Posted by an...@apache.org.
jcs beta-1 doesnt work for us


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/96bcc48a
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/96bcc48a
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/96bcc48a

Branch: refs/heads/tomee-7.0.0-M1
Commit: 96bcc48a200123ed79d860d1aeb4ba74bf8cace9
Parents: af57554
Author: Romain Manni-Bucau <rm...@gmail.com>
Authored: Sun Sep 27 07:44:15 2015 -0700
Committer: Romain Manni-Bucau <rm...@gmail.com>
Committed: Sun Sep 27 07:44:15 2015 -0700

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/96bcc48a/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0d42b62..62169e1 100644
--- a/pom.xml
+++ b/pom.xml
@@ -98,7 +98,7 @@
 
     <openjpa.version>2.4.0</openjpa.version>
     <org.apache.openwebbeans.version>1.6.2</org.apache.openwebbeans.version>
-    <jcs.version>2.0-beta-1</jcs.version>
+    <jcs.version>2.0-SNAPSHOT</jcs.version>
 
     <!-- Maven module versions -->
     <maven-bundle-plugin.version>2.3.7</maven-bundle-plugin.version>


[5/9] tomee git commit: fixing ArchivingTest

Posted by an...@apache.org.
fixing ArchivingTest


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/b2002617
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/b2002617
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/b2002617

Branch: refs/heads/tomee-7.0.0-M1
Commit: b200261787fe658ba1779cd2953b87ee85b5f30c
Parents: 94b4a96
Author: Romain Manni-Bucau <rm...@gmail.com>
Authored: Mon Sep 28 10:47:31 2015 -0700
Committer: Romain Manni-Bucau <rm...@gmail.com>
Committed: Mon Sep 28 10:47:31 2015 -0700

----------------------------------------------------------------------
 .../org/apache/tomee/jul/handler/rotating/ArchivingTest.java    | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/b2002617/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
index 77da90b..89215f5 100644
--- a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
+++ b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
@@ -97,18 +97,19 @@ public class ArchivingTest {
         final File logGzip = new File("target/ArchivingTest-" + format + "/logs/archives/test.2015-09-01.0.log." + format);
         assertTrue(logGzip.getAbsolutePath(), logGzip.isFile());
 
+        // note: size depends on the date so just use a > min
         if ("gzip".equals(format)) {
             try (final GZIPInputStream gis = new GZIPInputStream(new FileInputStream("target/ArchivingTest-gzip/logs/archives/test.2015-09-01.0.log.gzip"))) {
                 final String content = IOUtils.toString(gis);
                 assertTrue(content.contains("INFO: abcdefghij\n"));
-                assertEquals(10258, content.length());
+                assertTrue(content.length() > 10000);
             }
         } else {
             try (final ZipInputStream zis = new ZipInputStream(new FileInputStream("target/ArchivingTest-zip/logs/archives/test.2015-09-01.0.log.zip"))) {
                 assertEquals("test.2015-09-01.0.log", zis.getNextEntry().getName());
                 final String content = IOUtils.toString(zis);
                 assertTrue(content.contains("INFO: abcdefghij\n"));
-                assertEquals(10258, content.length());
+                assertTrue(content.length() > 10000);
                 assertNull(zis.getNextEntry());
             }
         }


[2/9] tomee git commit: TOMEE-1631 LocalFileHandler

Posted by an...@apache.org.
TOMEE-1631 LocalFileHandler


Project: http://git-wip-us.apache.org/repos/asf/tomee/repo
Commit: http://git-wip-us.apache.org/repos/asf/tomee/commit/af575544
Tree: http://git-wip-us.apache.org/repos/asf/tomee/tree/af575544
Diff: http://git-wip-us.apache.org/repos/asf/tomee/diff/af575544

Branch: refs/heads/tomee-7.0.0-M1
Commit: af575544450425cb3f4b1060ae7d4ef12862eba5
Parents: 8652068
Author: Romain Manni-Bucau <rm...@gmail.com>
Authored: Sat Sep 26 19:32:50 2015 -0700
Committer: Romain Manni-Bucau <rm...@gmail.com>
Committed: Sat Sep 26 19:32:50 2015 -0700

----------------------------------------------------------------------
 tomee/tomee-juli/pom.xml                        |  27 +
 .../handler/rotating/BackgroundTaskRunner.java  |  91 +++
 .../tomee/jul/handler/rotating/Duration.java    | 178 ++++++
 .../jul/handler/rotating/LocalFileHandler.java  | 553 +++++++++++++++++++
 .../apache/tomee/jul/handler/rotating/Size.java | 343 ++++++++++++
 .../jul/handler/rotating/ArchivingTest.java     | 215 +++++++
 .../handler/rotating/LocalFileHandlerTest.java  | 128 +++++
 .../tomee/jul/handler/rotating/PerfRunner.java  | 109 ++++
 8 files changed, 1644 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/af575544/tomee/tomee-juli/pom.xml
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/pom.xml b/tomee/tomee-juli/pom.xml
index eb4147e..885f55d 100644
--- a/tomee/tomee-juli/pom.xml
+++ b/tomee/tomee-juli/pom.xml
@@ -46,8 +46,35 @@
       <artifactId>slf4j-api</artifactId>
       <scope>provided</scope>
     </dependency>
+
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.openjdk.jmh</groupId>
+      <artifactId>jmh-core</artifactId>
+      <version>${jmh.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.openjdk.jmh</groupId>
+      <artifactId>jmh-generator-annprocess</artifactId>
+      <version>${jmh.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 
+  <properties>
+    <jmh.version>1.10.5</jmh.version>
+  </properties>
+
   <build>
     <plugins>
       <plugin>

http://git-wip-us.apache.org/repos/asf/tomee/blob/af575544/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/BackgroundTaskRunner.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/BackgroundTaskRunner.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/BackgroundTaskRunner.java
new file mode 100644
index 0000000..5b88b5f
--- /dev/null
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/BackgroundTaskRunner.java
@@ -0,0 +1,91 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.handler.rotating;
+
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ThreadFactory;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.LogManager;
+
+// Note: don't touch this class while not needed to avoid to trigger the executor service init
+// mainly there to avoid all handlers to have their own threads
+class BackgroundTaskRunner {
+    private static final ExecutorService EXECUTOR_SERVICE;
+    private static final boolean SYNCHRONOUS;
+
+    static {
+        final LogManager logManager = LogManager.getLogManager();
+        SYNCHRONOUS = Boolean.parseBoolean(getProperty(logManager, BackgroundTaskRunner.class.getName() + ".synchronous"));
+        if (SYNCHRONOUS) {
+            EXECUTOR_SERVICE = null;
+        } else {
+
+            final String threadCount = getProperty(logManager, BackgroundTaskRunner.class.getName() + ".threads");
+            final String shutdownTimeoutStr = getProperty(logManager, BackgroundTaskRunner.class.getName() + ".shutdownTimeout");
+            final Duration shutdownTimeout = new Duration(shutdownTimeoutStr == null ? "30 seconds" : shutdownTimeoutStr);
+            EXECUTOR_SERVICE = Executors.newFixedThreadPool(Integer.parseInt(threadCount == null ? "2" : threadCount), new ThreadFactory() {
+                private final ThreadGroup group;
+                private final AtomicInteger threadNumber = new AtomicInteger(1);
+                private final String namePrefix = "com.tomitribe.logging.jul.handler.BackgroundTaskThread-";
+
+                {
+                    SecurityManager s = System.getSecurityManager();
+                    group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
+                }
+
+                @Override
+                public Thread newThread(final Runnable r) {
+                    final Thread t = new Thread(group, r, namePrefix + threadNumber.getAndIncrement(), 0);
+                    if (!t.isDaemon()) {
+                        t.setDaemon(true);
+                    }
+                    if (t.getPriority() != Thread.NORM_PRIORITY) {
+                        t.setPriority(Thread.NORM_PRIORITY);
+                    }
+                    return t;
+                }
+            });
+
+            Runtime.getRuntime().addShutdownHook(new Thread() {
+                @Override
+                public void run() {
+                    EXECUTOR_SERVICE.shutdown();
+                    try {
+                        EXECUTOR_SERVICE.awaitTermination(shutdownTimeout.asMillis(), TimeUnit.MILLISECONDS);
+                    } catch (final InterruptedException e) {
+                        Thread.interrupted();
+                    }
+                }
+            });
+        }
+    }
+
+    private static String getProperty(final LogManager logManager, final String key) {
+        final String val = logManager.getProperty(key);
+        return val != null ? val : System.getProperty(key);
+    }
+
+    static void push(final Runnable runnable) {
+        if (SYNCHRONOUS) {
+            runnable.run();
+        } else {
+            EXECUTOR_SERVICE.submit(runnable);
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/af575544/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Duration.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Duration.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Duration.java
new file mode 100644
index 0000000..005f43a
--- /dev/null
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Duration.java
@@ -0,0 +1,178 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.handler.rotating;
+
+import java.util.concurrent.TimeUnit;
+
+class Duration {
+    private long time;
+    private TimeUnit unit = TimeUnit.MILLISECONDS;
+
+    private Duration() {
+        // no-op
+    }
+
+    private Duration(final long time, final TimeUnit unit) {
+        this.time = time;
+        this.unit = unit;
+    }
+
+    Duration(final String string) {
+        this(string, null);
+    }
+
+    private Duration(final String string, final TimeUnit defaultUnit) {
+        final String[] strings = string.split(",| and ");
+
+        Duration total = new Duration();
+
+        for (final String value : strings) {
+            final Duration part = new Duration();
+            final String s = value.trim();
+
+            final StringBuilder t = new StringBuilder();
+            final StringBuilder u = new StringBuilder();
+
+            int i = 0;
+
+            // get the number
+            for (; i < s.length(); i++) {
+                final char c = s.charAt(i);
+                if (Character.isDigit(c) || i == 0 && c == '-') {
+                    t.append(c);
+                } else {
+                    break;
+                }
+            }
+
+            if (t.length() == 0) {
+                invalidFormat(s);
+            }
+
+            // skip whitespace
+            for (; i < s.length(); i++) {
+                final char c = s.charAt(i);
+                if (!Character.isWhitespace(c)) {
+                    break;
+                }
+            }
+
+            // get time unit text part
+            for (; i < s.length(); i++) {
+                final char c = s.charAt(i);
+                if (Character.isLetter(c)) {
+                    u.append(c);
+                } else {
+                    invalidFormat(s);
+                }
+            }
+
+            part.time = Long.parseLong(t.toString());
+
+            part.unit = parseUnit(u.toString());
+
+            if (part.unit == null) {
+                part.unit = defaultUnit;
+            }
+
+            total = total.add(part);
+        }
+
+        this.time = total.time;
+        this.unit = total.unit;
+    }
+
+    public long asMillis() {
+        return unit.toMillis(time);
+    }
+
+    private static class Normalize {
+        private long a;
+        private long b;
+        private TimeUnit base;
+
+        private Normalize(final Duration a, final Duration b) {
+            this.base = lowest(a, b);
+            this.a = a.unit == null ? a.time : base.convert(a.time, a.unit);
+            this.b = b.unit == null ? b.time : base.convert(b.time, b.unit);
+        }
+
+        private static TimeUnit lowest(final Duration a, final Duration b) {
+            if (a.unit == null) return b.unit;
+            if (b.unit == null) return a.unit;
+            if (a.time == 0) return b.unit;
+            if (b.time == 0) return a.unit;
+            return TimeUnit.values()[Math.min(a.unit.ordinal(), b.unit.ordinal())];
+        }
+    }
+
+    public Duration add(final Duration that) {
+        final Normalize n = new Normalize(this, that);
+        return new Duration(n.a + n.b, n.base);
+    }
+
+    private static void invalidFormat(final String text) {
+        throw new IllegalArgumentException("Illegal duration format: '" + text +
+            "'.  Valid examples are '10s' or '10 seconds'.");
+    }
+
+    private static TimeUnit parseUnit(final String u) {
+        if (u.length() == 0) {
+            return null;
+        }
+
+        if ("NANOSECONDS".equalsIgnoreCase(u)) return TimeUnit.NANOSECONDS;
+        if ("NANOSECOND".equalsIgnoreCase(u)) return TimeUnit.NANOSECONDS;
+        if ("NANOS".equalsIgnoreCase(u)) return TimeUnit.NANOSECONDS;
+        if ("NANO".equalsIgnoreCase(u)) return TimeUnit.NANOSECONDS;
+        if ("NS".equalsIgnoreCase(u)) return TimeUnit.NANOSECONDS;
+
+        if ("MICROSECONDS".equalsIgnoreCase(u)) return TimeUnit.MICROSECONDS;
+        if ("MICROSECOND".equalsIgnoreCase(u)) return TimeUnit.MICROSECONDS;
+        if ("MICROS".equalsIgnoreCase(u)) return TimeUnit.MICROSECONDS;
+        if ("MICRO".equalsIgnoreCase(u)) return TimeUnit.MICROSECONDS;
+
+        if ("MILLISECONDS".equalsIgnoreCase(u)) return TimeUnit.MILLISECONDS;
+        if ("MILLISECOND".equalsIgnoreCase(u)) return TimeUnit.MILLISECONDS;
+        if ("MILLIS".equalsIgnoreCase(u)) return TimeUnit.MILLISECONDS;
+        if ("MILLI".equalsIgnoreCase(u)) return TimeUnit.MILLISECONDS;
+        if ("MS".equalsIgnoreCase(u)) return TimeUnit.MILLISECONDS;
+
+        if ("SECONDS".equalsIgnoreCase(u)) return TimeUnit.SECONDS;
+        if ("SECOND".equalsIgnoreCase(u)) return TimeUnit.SECONDS;
+        if ("SEC".equalsIgnoreCase(u)) return TimeUnit.SECONDS;
+        if ("S".equalsIgnoreCase(u)) return TimeUnit.SECONDS;
+
+        if ("MINUTES".equalsIgnoreCase(u)) return TimeUnit.MINUTES;
+        if ("MINUTE".equalsIgnoreCase(u)) return TimeUnit.MINUTES;
+        if ("MIN".equalsIgnoreCase(u)) return TimeUnit.MINUTES;
+        if ("M".equalsIgnoreCase(u)) return TimeUnit.MINUTES;
+
+        if ("HOURS".equalsIgnoreCase(u)) return TimeUnit.HOURS;
+        if ("HOUR".equalsIgnoreCase(u)) return TimeUnit.HOURS;
+        if ("HRS".equalsIgnoreCase(u)) return TimeUnit.HOURS;
+        if ("HR".equalsIgnoreCase(u)) return TimeUnit.HOURS;
+        if ("H".equalsIgnoreCase(u)) return TimeUnit.HOURS;
+
+        if ("DAYS".equalsIgnoreCase(u)) return TimeUnit.DAYS;
+        if ("DAY".equalsIgnoreCase(u)) return TimeUnit.DAYS;
+        if ("D".equalsIgnoreCase(u)) return TimeUnit.DAYS;
+
+        throw new IllegalArgumentException("Unknown time unit '" + u + "'");
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/tomee/blob/af575544/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
new file mode 100644
index 0000000..7656063
--- /dev/null
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/LocalFileHandler.java
@@ -0,0 +1,553 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.handler.rotating;
+
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FilenameFilter;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.nio.file.Files;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.sql.Timestamp;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.logging.ErrorManager;
+import java.util.logging.Filter;
+import java.util.logging.Formatter;
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.logging.LogRecord;
+import java.util.logging.SimpleFormatter;
+import java.util.regex.Pattern;
+import java.util.zip.Deflater;
+import java.util.zip.GZIPOutputStream;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+/**
+ *  NOTE: for simplicity the prefix `org.apache.tomee.jul.handler.rotating.LocalFileHandler.` has been removed of name columns.
+ *
+ *  |===
+ *  | Name                      | Default Value                                     | Description
+ *  | filenamePattern           | ${catalina.base}/logs/logs.%s.%03d.log            | where log files are created, it uses String.format() and gives you the date and file number - in this order.
+ *  | limit                     | 10 Megabytes                                      | limit size indicating the file should be rotated
+ *  | dateCheckInterval         | 5 seconds                                         | how often the date should be computed to rotate the file (don't do it each time for performances reason, means you can get few records of next day in a file name with current day)
+ *  | bufferSize                | -1 bytes                                          | if positive the in memory buffer used to store data before flushing them to the disk
+ *  | encoding                  | -                                                 | file encoding
+ *  | level                     | ALL                                               | level this handler accepts
+ *  | filter                    | -                                                 | filter used to check if the message should be logged
+ *  | formatter                 | java.util.logging.SimpleFormatter                 | formatter used to format messages
+ *  | archiveDirectory          | ${catalina.base}/logs/archives/                   | where compressed logs are put.
+ *  | archiveFormat             | gzip                                              | zip or gzip.
+ *  | archiveOlderThan          | -1 days                                           | how many days files are kept before being compressed
+ *  | purgeOlderThan            | -1 days                                           | how many days files are kept before being deleted, note: it applies on archives and not log files so 2 days of archiving and 3 days of purge makes it deleted after 5 days.
+ *  | compressionLevel          | -1                                                | In case of zip archiving the zip compression level (-1 for off or 0-9).
+ *  |===
+ *
+ *  NOTE: archiving and purging are done only when a file is rotated, it means it can be ignored during days if there is no logging activity.
+ *
+ * NOTE: archiving and purging is done in a background thread pool, you can configure the number of threads in thanks to
+ * `org.apache.tomee.jul.handler.rotating.BackgroundTaskRunner.threads` property in `conf/logging.properties`.
+ * Default is 2 which should be fine for most applications.
+ */
+/*
+ Open point/enhancements:
+  - date pattern/filename pattern instead of hardcoded String.format?
+  - write another async version? ensure it flushed well, use disruptor? -> bench seems to show it is useless
+ */
+public class LocalFileHandler extends Handler {
+    private static final int BUFFER_SIZE = 8102;
+
+    private long limit = 0;
+    private int bufferSize = -1;
+    private Pattern filenameRegex;
+    private Pattern archiveFilenameRegex;
+    private String filenamePattern = "${catalina.base}/logs/logs.%s.%03d.log";
+    private String archiveFormat = "gzip";
+    private long dateCheckInterval = TimeUnit.SECONDS.toMillis(5);
+    private long archiveExpiryDuration;
+    private int compressionLevel;
+    private long purgeExpiryDuration;
+    private File archiveDir;
+
+    private volatile int currentIndex;
+    private volatile long lastTimestamp;
+    private volatile String date;
+    private volatile PrintWriter writer;
+    private volatile int written;
+    private final ReadWriteLock writerLock = new ReentrantReadWriteLock();
+    private final Lock backgroundTaskLock = new ReentrantLock();
+    private volatile boolean closed;
+
+    public LocalFileHandler() {
+        configure();
+    }
+
+    private void configure() {
+        date = currentDate();
+
+        final String className = getClass().getName(); //allow classes to override
+
+        final ClassLoader cl = Thread.currentThread().getContextClassLoader();
+
+        dateCheckInterval = new Duration(getProperty(className + ".dateCheckInterval", String.valueOf(dateCheckInterval))).asMillis();
+        filenamePattern = replace(getProperty(className + ".filenamePattern", filenamePattern));
+        limit = new Size(getProperty(className + ".limit", String.valueOf("10 Mega"))).asBytes();
+
+        final int lastSep = Math.max(filenamePattern.lastIndexOf('/'), filenamePattern.lastIndexOf('\\'));
+        String fileNameReg = lastSep >= 0 ? filenamePattern.substring(lastSep + 1) : filenamePattern;
+        fileNameReg = fileNameReg.replace("%s", "\\d{4}\\-\\d{2}\\-\\d{2}"); // date.
+        {   // file rotation index
+            final int indexIdxStart = fileNameReg.indexOf('%');
+            if (indexIdxStart >= 0) {
+                final int indexIdxEnd = fileNameReg.indexOf('d', indexIdxStart);
+                if (indexIdxEnd >= 0) {
+                    fileNameReg = fileNameReg.substring(0, indexIdxStart) + "\\d*" + fileNameReg.substring(indexIdxEnd + 1, fileNameReg.length());
+                }
+            }
+        }
+        filenameRegex = Pattern.compile(fileNameReg);
+
+        compressionLevel = Integer.parseInt(getProperty(className + ".compressionLevel", String.valueOf(Deflater.DEFAULT_COMPRESSION)));
+        archiveExpiryDuration = new Duration(getProperty(className + ".archiveOlderThan", String.valueOf("-1 days"))).asMillis();
+        archiveDir = new File(replace(getProperty(className + ".archiveDirectory", "${catalina.base}/logs/archives/")));
+        archiveFormat = replace(getProperty(className + ".archiveFormat", archiveFormat));
+        archiveFilenameRegex = Pattern.compile(fileNameReg + "\\." + archiveFormat);
+
+        purgeExpiryDuration = new Duration(getProperty(className + ".purgeOlderThan", String.valueOf("-1 days"))).asMillis();
+
+        try {
+            bufferSize = (int) new Size(getProperty(className + ".bufferSize", "-1 b")).asBytes();
+        } catch (final NumberFormatException ignore) {
+            // no-op
+        }
+
+        final String encoding = getProperty(className + ".encoding", null);
+        if (encoding != null && encoding.length() > 0) {
+            try {
+                setEncoding(encoding);
+            } catch (final UnsupportedEncodingException ex) {
+                // no-op
+            }
+        }
+
+        setLevel(Level.parse(getProperty(className + ".level", "" + Level.ALL)));
+
+        final String filterName = getProperty(className + ".filter", null);
+        if (filterName != null) {
+            try {
+                setFilter(Filter.class.cast(cl.loadClass(filterName).newInstance()));
+            } catch (final Exception e) {
+                // Ignore
+            }
+        }
+
+        final String formatterName = getProperty(className + ".formatter", null);
+        if (formatterName != null) {
+            try {
+                setFormatter(Formatter.class.cast(cl.loadClass(formatterName).newInstance()));
+            } catch (final Exception e) {
+                setFormatter(new SimpleFormatter());
+            }
+        } else {
+            setFormatter(new SimpleFormatter());
+        }
+
+        setErrorManager(new ErrorManager());
+
+        lastTimestamp = System.currentTimeMillis();
+    }
+
+    protected String currentDate() {
+        return new Timestamp(System.currentTimeMillis()).toString().substring(0, 10);
+    }
+
+    @Override
+    public void publish(final LogRecord record) {
+        if (!isLoggable(record)) {
+            return;
+        }
+
+        final long now = System.currentTimeMillis();
+        final String tsDate;
+        // just do it once / sec if we have a lot of log, can make some log appearing in the wrong file but better than doing it each time
+        if (now - lastTimestamp > dateCheckInterval) { // using as much as possible volatile to avoid to lock too much
+            lastTimestamp = now;
+            tsDate = currentDate();
+        } else {
+            tsDate = null;
+        }
+
+        try {
+            writerLock.readLock().lock();
+            rotateIfNeeded(tsDate);
+
+            String result;
+            try {
+                result = getFormatter().format(record);
+            } catch (final Exception e) {
+                reportError(null, e, ErrorManager.FORMAT_FAILURE);
+                return;
+            }
+
+            try {
+                if (writer != null) {
+                    writer.write(result);
+                    if (bufferSize < 0) {
+                        writer.flush();
+                    }
+                } else {
+                    reportError(getClass().getSimpleName() + " is closed or not yet initialized, unable to log [" + result + "]", null, ErrorManager.WRITE_FAILURE);
+                }
+            } catch (final Exception e) {
+                reportError(null, e, ErrorManager.WRITE_FAILURE);
+            }
+        } finally {
+            writerLock.readLock().unlock();
+        }
+    }
+
+    private void rotateIfNeeded(final String currentDate) {
+        if (!closed && writer == null) {
+            try {
+                writerLock.readLock().unlock();
+                writerLock.writeLock().lock();
+
+                if (!closed && writer == null) {
+                    openWriter();
+                }
+            } finally {
+                writerLock.writeLock().unlock();
+                writerLock.readLock().lock();
+            }
+        } else if (shouldRotate(currentDate)) {
+            try {
+                writerLock.readLock().unlock();
+                writerLock.writeLock().lock();
+
+                if (shouldRotate(currentDate)) {
+                    close();
+                    if (currentDate != null && !date.equals(currentDate)) {
+                        currentIndex = 0;
+                        date = currentDate;
+                    }
+                    openWriter();
+                }
+            } finally {
+                writerLock.writeLock().unlock();
+                writerLock.readLock().lock();
+            }
+        }
+    }
+
+    private boolean shouldRotate(final String currentDate) { // new day, new file or limit exceeded
+        return (currentDate != null && !date.equals(currentDate)) || (limit > 0 && written >= limit);
+    }
+
+    @Override
+    public void close() {
+        closed = true;
+
+        writerLock.writeLock().lock();
+        try {
+            if (writer == null) {
+                return;
+            }
+            writer.write(getFormatter().getTail(this));
+            writer.flush();
+            writer.close();
+            writer = null;
+        } catch (final Exception e) {
+            reportError(null, e, ErrorManager.CLOSE_FAILURE);
+        } finally {
+            writerLock.writeLock().unlock();
+        }
+
+        // wait for bg tasks if running
+        backgroundTaskLock.lock();
+        backgroundTaskLock.unlock();
+    }
+
+    @Override
+    public void flush() {
+        writerLock.readLock().lock();
+        try {
+            writer.flush();
+        } catch (final Exception e) {
+            reportError(null, e, ErrorManager.FLUSH_FAILURE);
+        } finally {
+            writerLock.readLock().unlock();
+        }
+    }
+
+    protected void openWriter() {
+        final long beforeRotation = System.currentTimeMillis();
+
+        writerLock.writeLock().lock();
+        FileOutputStream fos = null;
+        OutputStream os = null;
+        try {
+            File pathname;
+            do {
+                pathname = new File(formatFilename(filenamePattern, date, currentIndex));
+                final File parent = pathname.getParentFile();
+                if (!parent.isDirectory() && !parent.mkdirs()) {
+                    reportError("Unable to create [" + parent + "]", null, ErrorManager.OPEN_FAILURE);
+                    writer = null;
+                    return;
+                }
+                currentIndex++;
+            } while (pathname.isFile()); // loop to ensure we don't overwrite existing files
+
+            final String encoding = getEncoding();
+            fos = new FileOutputStream(pathname, true);
+            os = new CountingStream(bufferSize > 0 ? new BufferedOutputStream(fos, bufferSize) : fos);
+            writer = new PrintWriter((encoding != null) ? new OutputStreamWriter(os, encoding) : new OutputStreamWriter(os), false);
+            writer.write(getFormatter().getHead(this));
+        } catch (final Exception e) {
+            reportError(null, e, ErrorManager.OPEN_FAILURE);
+            writer = null;
+            if (fos != null) {
+                try {
+                    fos.close();
+                } catch (final IOException e1) {
+                    // no-op
+                }
+            }
+            if (os != null) {
+                try {
+                    os.close();
+                } catch (final IOException e1) {
+                    // no-op
+                }
+            }
+        } finally {
+            writerLock.writeLock().unlock();
+        }
+
+        BackgroundTaskRunner.push(new Runnable() {
+            @Override
+            public void run() {
+                backgroundTaskLock.lock();
+                try {
+                    evict(beforeRotation);
+                } catch (final Exception e) {
+                    reportError("Can't do the log eviction", e, ErrorManager.GENERIC_FAILURE);
+                } finally {
+                    backgroundTaskLock.unlock();
+                }
+            }
+        });
+    }
+
+    private void evict(final long now) {
+        if (purgeExpiryDuration > 0) { // purging archives
+            final File[] archives = archiveDir.listFiles(new FilenameFilter() {
+                @Override
+                public boolean accept(final File dir, final String name) {
+                    return archiveFilenameRegex.matcher(name).matches();
+                }
+            });
+
+            if (archives != null) {
+                for (final File archive : archives) {
+                    try {
+                        final BasicFileAttributes attr = Files.readAttributes(archive.toPath(), BasicFileAttributes.class);
+                        if (now - attr.creationTime().toMillis() > purgeExpiryDuration) {
+                            if (!Files.deleteIfExists(archive.toPath())) {
+                                // dont try to delete on exit cause we will find it again
+                                reportError("Can't delete " + archive.getAbsolutePath() + ".", null, ErrorManager.GENERIC_FAILURE);
+                            }
+                        }
+                    } catch (final IOException e) {
+                        throw new IllegalStateException(e);
+                    }
+                }
+            }
+        }
+        if (archiveExpiryDuration > 0) { // archiving log files
+            final File[] logs = new File(formatFilename(filenamePattern, "0000-00-00", 0)).getParentFile()
+                .listFiles(new FilenameFilter() {
+                    @Override
+                    public boolean accept(final File dir, final String name) {
+                        return filenameRegex.matcher(name).matches();
+                    }
+                });
+
+            if (logs != null) {
+                for (final File file : logs) {
+                    try {
+                        final BasicFileAttributes attr = Files.readAttributes(file.toPath(), BasicFileAttributes.class);
+                        if (attr.creationTime().toMillis() < now && now - attr.lastModifiedTime().toMillis() > archiveExpiryDuration) {
+                            createArchive(file);
+                        }
+                    } catch (final IOException e) {
+                        throw new IllegalStateException(e);
+                    }
+                }
+            }
+        }
+    }
+
+    private String formatFilename(final String pattern, final String date, final int index) {
+        return String.format(pattern, date, index);
+    }
+
+    private void createArchive(final File source) {
+        final File target = new File(archiveDir, source.getName() + "." + archiveFormat);
+        if (target.isFile()) {
+            return;
+        }
+
+        final File parentFile = target.getParentFile();
+        if (!parentFile.isDirectory() && !parentFile.mkdirs()) {
+            throw new IllegalStateException("Can't create " + parentFile.getAbsolutePath());
+        }
+
+        if (archiveFormat.equalsIgnoreCase("gzip")) {
+            try (final OutputStream outputStream = new BufferedOutputStream(new GZIPOutputStream(new FileOutputStream(target)))) {
+                final byte[] buffer = new byte[BUFFER_SIZE];
+                try (final FileInputStream inputStream = new FileInputStream(source)) {
+                    copyStream(inputStream, outputStream, buffer);
+                } catch (final IOException e) {
+                    throw new IllegalStateException(e);
+                }
+            } catch (final IOException e) {
+                throw new IllegalStateException(e);
+            }
+        } else { // consider file defines a zip whatever extension it is
+            try (final ZipOutputStream outputStream = new ZipOutputStream(new FileOutputStream(target))) {
+                outputStream.setLevel(compressionLevel);
+
+                final byte[] buffer = new byte[BUFFER_SIZE];
+                try (final FileInputStream inputStream = new FileInputStream(source)) {
+                    final ZipEntry zipEntry = new ZipEntry(source.getName());
+                    outputStream.putNextEntry(zipEntry);
+                    copyStream(inputStream, outputStream, buffer);
+                } catch (final IOException e) {
+                    throw new IllegalStateException(e);
+                }
+            } catch (final IOException e) {
+                throw new IllegalStateException(e);
+            }
+        }
+        try {
+            if (!Files.deleteIfExists(source.toPath())) {
+                reportError("Can't delete " + source.getAbsolutePath() + ".", null, ErrorManager.GENERIC_FAILURE);
+            }
+        } catch (final IOException e) {
+            throw new IllegalStateException(e);
+        }
+    }
+
+    private static void copyStream(final InputStream inputStream, final OutputStream outputStream, final byte[] buffer) throws IOException {
+        int n;
+        while ((n = inputStream.read(buffer)) != -1) {
+            outputStream.write(buffer, 0, n);
+        }
+    }
+
+    protected String getProperty(final String name, final String defaultValue) {
+        String value = LogManager.getLogManager().getProperty(name);
+        if (value == null) {
+            value = defaultValue;
+        } else {
+            value = value.trim();
+        }
+        return value;
+    }
+
+    protected static String replace(final String str) { // [lang3] would be good but no dep for these classes is better
+        String result = str;
+        int start = str.indexOf("${");
+        if (start >= 0) {
+            final StringBuilder builder = new StringBuilder();
+            int end = -1;
+            while (start >= 0) {
+                builder.append(str, end + 1, start);
+                end = str.indexOf('}', start + 2);
+                if (end < 0) {
+                    end = start - 1;
+                    break;
+                }
+
+                final String propName = str.substring(start + 2, end);
+                String replacement = !propName.isEmpty() ? System.getProperty(propName) : null;
+                if (replacement == null) {
+                    replacement = System.getenv(propName);
+                }
+                if (replacement != null) {
+                    builder.append(replacement);
+                } else {
+                    builder.append(str, start, end + 1);
+                }
+                start = str.indexOf("${", end + 1);
+            }
+            builder.append(str, end + 1, str.length());
+            result = builder.toString();
+        }
+        return result;
+    }
+
+    private class CountingStream extends OutputStream {
+        private final OutputStream out;
+
+        private CountingStream(final OutputStream out) {
+            this.out = out;
+            written = 0;
+        }
+
+        @Override
+        public void write(final int b) throws IOException {
+            out.write(b);
+            written++;
+        }
+
+        @Override
+        public void write(final byte buff[]) throws IOException {
+            out.write(buff);
+            written += buff.length;
+        }
+
+        @Override
+        public void write(final byte buff[], final int off, final int len) throws IOException {
+            out.write(buff, off, len);
+            written += len;
+        }
+
+        @Override
+        public void flush() throws IOException {
+            out.flush();
+        }
+
+        @Override
+        public void close() throws IOException {
+            out.close();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/af575544/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Size.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Size.java b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Size.java
new file mode 100644
index 0000000..be1b476
--- /dev/null
+++ b/tomee/tomee-juli/src/main/java/org/apache/tomee/jul/handler/rotating/Size.java
@@ -0,0 +1,343 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.handler.rotating;
+
+import static java.lang.Long.MAX_VALUE;
+
+class Size {
+    private long size;
+    private SizeUnit unit;
+
+    private Size() {
+        // no-op
+    }
+
+    private Size(final long size, final SizeUnit unit) {
+        this.size = size;
+        this.unit = unit;
+    }
+
+    Size(final String string) {
+        this(string, null);
+    }
+
+    private Size(final String string, final SizeUnit defaultUnit) {
+        final String[] strings = string.split(",| and ");
+
+        Size total = new Size();
+        for (String s : strings) {
+            final Size part = new Size();
+            s = s.trim();
+
+            final StringBuilder t = new StringBuilder();
+            final StringBuilder u = new StringBuilder();
+
+            int i = 0;
+
+            // get the number
+            for (; i < s.length(); i++) {
+                final char c = s.charAt(i);
+                if (Character.isDigit(c) || i == 0 && c == '-' || i > 0 && c == '.') {
+                    t.append(c);
+                } else {
+                    break;
+                }
+            }
+
+            if (t.length() == 0) {
+                invalidFormat(s);
+            }
+
+            // skip whitespace
+            for (; i < s.length(); i++) {
+                final char c = s.charAt(i);
+                if (!Character.isWhitespace(c)) {
+                    break;
+                }
+            }
+
+            // get time unit text part
+            for (; i < s.length(); i++) {
+                final char c = s.charAt(i);
+                if (Character.isLetter(c)) {
+                    u.append(c);
+                } else {
+                    invalidFormat(s);
+                }
+            }
+
+
+            part.unit = parseUnit(u.toString());
+
+            if (part.unit == null) {
+                part.unit = defaultUnit;
+            }
+
+            final String size = t.toString();
+            if (size.contains(".")) {
+                if (part.unit == null) {
+                    throw new IllegalArgumentException("unit must be specified with floating point numbers");
+                }
+                final double d = Double.parseDouble(size);
+                final long bytes = part.unit.toBytes(1);
+                part.size = (long) (bytes * d);
+                part.unit = SizeUnit.BYTES;
+            } else {
+                part.size = Integer.parseInt(size);
+            }
+
+            total = total.add(part);
+        }
+
+        this.size = total.size;
+        this.unit = total.unit;
+    }
+
+    public long asBytes() {
+        return unit.toBytes(size);
+    }
+
+    private static class Normalize {
+        private long a;
+        private long b;
+        private SizeUnit base;
+
+        private Normalize(final Size a, final Size b) {
+            this.base = lowest(a, b);
+            this.a = a.unit == null ? a.size : base.convert(a.size, a.unit);
+            this.b = b.unit == null ? b.size : base.convert(b.size, b.unit);
+        }
+
+        private static SizeUnit lowest(final Size a, final Size b) {
+            if (a.unit == null) return b.unit;
+            if (b.unit == null) return a.unit;
+            if (a.size == 0) return b.unit;
+            if (b.size == 0) return a.unit;
+            return SizeUnit.values()[Math.min(a.unit.ordinal(), b.unit.ordinal())];
+        }
+    }
+
+    public Size add(final Size that) {
+        final Normalize n = new Normalize(this, that);
+        return new Size(n.a + n.b, n.base);
+    }
+
+    private static void invalidFormat(final String text) {
+        throw new IllegalArgumentException("Illegal size format: '" + text + "'.  Valid examples are '10kb' or '10 kilobytes'.");
+    }
+
+    private static SizeUnit parseUnit(final String u) {
+        if (u.length() == 0) return null;
+
+        if ("BYTES".equalsIgnoreCase(u)) return SizeUnit.BYTES;
+        if ("BYTE".equalsIgnoreCase(u)) return SizeUnit.BYTES;
+        if ("B".equalsIgnoreCase(u)) return SizeUnit.BYTES;
+
+        if ("KILOBYTES".equalsIgnoreCase(u)) return SizeUnit.KILOBYTES;
+        if ("KILOBYTE".equalsIgnoreCase(u)) return SizeUnit.KILOBYTES;
+        if ("KILO".equalsIgnoreCase(u)) return SizeUnit.KILOBYTES;
+        if ("KB".equalsIgnoreCase(u)) return SizeUnit.KILOBYTES;
+        if ("K".equalsIgnoreCase(u)) return SizeUnit.KILOBYTES;
+
+        if ("MEGABYTES".equalsIgnoreCase(u)) return SizeUnit.MEGABYTES;
+        if ("MEGABYTE".equalsIgnoreCase(u)) return SizeUnit.MEGABYTES;
+        if ("MEGA".equalsIgnoreCase(u)) return SizeUnit.MEGABYTES;
+        if ("MB".equalsIgnoreCase(u)) return SizeUnit.MEGABYTES;
+        if ("M".equalsIgnoreCase(u)) return SizeUnit.MEGABYTES;
+
+        if ("GIGABYTES".equalsIgnoreCase(u)) return SizeUnit.GIGABYTES;
+        if ("GIGABYTE".equalsIgnoreCase(u)) return SizeUnit.GIGABYTES;
+        if ("GIGA".equalsIgnoreCase(u)) return SizeUnit.GIGABYTES;
+        if ("GB".equalsIgnoreCase(u)) return SizeUnit.GIGABYTES;
+        if ("G".equalsIgnoreCase(u)) return SizeUnit.GIGABYTES;
+
+        throw new IllegalArgumentException("Unknown size unit '" + u + "'");
+    }
+
+    private enum SizeUnit {
+        BYTES {
+            public long toBytes(final long s) {
+                return s;
+            }
+
+            public long toKilobytes(final long s) {
+                return s / (B1 / B0);
+            }
+
+            public long toMegabytes(final long s) {
+                return s / (B2 / B0);
+            }
+
+            public long toGigabytes(final long s) {
+                return s / (B3 / B0);
+            }
+
+            public long toTerabytes(final long s) {
+                return s / (B4 / B0);
+            }
+
+            public long convert(final long s, final SizeUnit u) {
+                return u.toBytes(s);
+            }
+        },
+
+        KILOBYTES {
+            public long toBytes(final long s) {
+                return x(s, B1 / B0, MAX_VALUE / (B1 / B0));
+            }
+
+            public long toKilobytes(final long s) {
+                return s;
+            }
+
+            public long toMegabytes(final long s) {
+                return s / (B2 / B1);
+            }
+
+            public long toGigabytes(final long s) {
+                return s / (B3 / B1);
+            }
+
+            public long toTerabytes(final long s) {
+                return s / (B4 / B1);
+            }
+
+            public long convert(final long s, final SizeUnit u) {
+                return u.toKilobytes(s);
+            }
+        },
+
+        MEGABYTES {
+            public long toBytes(final long s) {
+                return x(s, B2 / B0, MAX_VALUE / (B2 / B0));
+            }
+
+            public long toKilobytes(final long s) {
+                return x(s, B2 / B1, MAX_VALUE / (B2 / B1));
+            }
+
+            public long toMegabytes(final long s) {
+                return s;
+            }
+
+            public long toGigabytes(final long s) {
+                return s / (B3 / B2);
+            }
+
+            public long toTerabytes(final long s) {
+                return s / (B4 / B2);
+            }
+
+            public long convert(final long s, final SizeUnit u) {
+                return u.toMegabytes(s);
+            }
+        },
+
+        GIGABYTES {
+            public long toBytes(final long s) {
+                return x(s, B3 / B0, MAX_VALUE / (B3 / B0));
+            }
+
+            public long toKilobytes(final long s) {
+                return x(s, B3 / B1, MAX_VALUE / (B3 / B1));
+            }
+
+            public long toMegabytes(final long s) {
+                return x(s, B3 / B2, MAX_VALUE / (B3 / B2));
+            }
+
+            public long toGigabytes(final long s) {
+                return s;
+            }
+
+            public long toTerabytes(final long s) {
+                return s / (B4 / B3);
+            }
+
+            public long convert(final long s, final SizeUnit u) {
+                return u.toGigabytes(s);
+            }
+        },
+
+        TERABYTES {
+            public long toBytes(final long s) {
+                return x(s, B4 / B0, MAX_VALUE / (B4 / B0));
+            }
+
+            public long toKilobytes(final long s) {
+                return x(s, B4 / B1, MAX_VALUE / (B4 / B1));
+            }
+
+            public long toMegabytes(final long s) {
+                return x(s, B4 / B2, MAX_VALUE / (B4 / B2));
+            }
+
+            public long toGigabytes(final long s) {
+                return x(s, B4 / B3, MAX_VALUE / (B4 / B3));
+            }
+
+            public long toTerabytes(final long s) {
+                return s;
+            }
+
+            public long convert(final long s, final SizeUnit u) {
+                return u.toTerabytes(s);
+            }
+        };
+
+        static final long B0 = 1L;
+        static final long B1 = B0 * 1024L;
+        static final long B2 = B1 * 1024L;
+        static final long B3 = B2 * 1024L;
+        static final long B4 = B3 * 1024L;
+
+
+        static long x(final long d, final long m, final long over) {
+            if (d > over) {
+                return MAX_VALUE;
+            }
+            if (d < -over) {
+                return Long.MIN_VALUE;
+            }
+            return d * m;
+        }
+
+        public long toBytes(final long size) {
+            throw new AbstractMethodError();
+        }
+
+        public long toKilobytes(final long size) {
+            throw new AbstractMethodError();
+        }
+
+        public long toMegabytes(final long size) {
+            throw new AbstractMethodError();
+        }
+
+        public long toGigabytes(final long size) {
+            throw new AbstractMethodError();
+        }
+
+        public long toTerabytes(final long size) {
+            throw new AbstractMethodError();
+        }
+
+        public long convert(final long sourceSize, final SizeUnit sourceUnit) {
+            throw new AbstractMethodError();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/af575544/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
new file mode 100644
index 0000000..77da90b
--- /dev/null
+++ b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/ArchivingTest.java
@@ -0,0 +1,215 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.handler.rotating;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.ZipInputStream;
+
+import static java.util.Arrays.asList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+@RunWith(Parameterized.class)
+public class ArchivingTest {
+    @Parameterized.Parameters(name = "{0}")
+    public static String[][] formats() {
+        return new String[][] { { "zip" }, { "gzip" } };
+    }
+
+    @Parameterized.Parameter(0)
+    public String format;
+
+    @Test
+    public void logAndRotate() throws IOException, NoSuchMethodException {
+        clean("target/ArchivingTest-" + format + "/logs");
+
+        final AtomicReference<String> today = new AtomicReference<>();
+        final Map<String, String> config = new HashMap<>();
+
+        // initial config
+        today.set("2015-09-01");
+        config.put("filenamePattern", "target/ArchivingTest-" + format + "/logs/test.%s.%d.log");
+        config.put("archiveDirectory", "target/ArchivingTest-" + format + "/logs/archives");
+        config.put("archiveFormat", format);
+        config.put("archiveOlderThan", "1 s");
+        config.put("limit", "10 kilobytes");
+        config.put("level", "INFO");
+        config.put("dateCheckInterval", "1 second");
+
+        final LocalFileHandler handler = new LocalFileHandler() {
+            @Override
+            protected String currentDate() {
+                return today.get();
+            }
+
+            @Override
+            protected String getProperty(final String name, final String defaultValue) {
+                final String s = config.get(name.substring(name.lastIndexOf('.') + 1));
+                return s != null ? s : defaultValue;
+            }
+        };
+
+        final String string10chars = "abcdefghij";
+        final int iterations = 950;
+        for (int i = 0; i < iterations; i++) {
+            handler.publish(new LogRecord(Level.INFO, string10chars));
+        }
+
+        today.set("2015-09-02");
+        try { // ensure we test the date
+            Thread.sleep(1500);
+        } catch (final InterruptedException e) {
+            Thread.interrupted();
+        }
+        handler.publish(new LogRecord(Level.INFO, string10chars)); // will trigger the archiving
+        handler.close();
+
+        final File logGzip = new File("target/ArchivingTest-" + format + "/logs/archives/test.2015-09-01.0.log." + format);
+        assertTrue(logGzip.getAbsolutePath(), logGzip.isFile());
+
+        if ("gzip".equals(format)) {
+            try (final GZIPInputStream gis = new GZIPInputStream(new FileInputStream("target/ArchivingTest-gzip/logs/archives/test.2015-09-01.0.log.gzip"))) {
+                final String content = IOUtils.toString(gis);
+                assertTrue(content.contains("INFO: abcdefghij\n"));
+                assertEquals(10258, content.length());
+            }
+        } else {
+            try (final ZipInputStream zis = new ZipInputStream(new FileInputStream("target/ArchivingTest-zip/logs/archives/test.2015-09-01.0.log.zip"))) {
+                assertEquals("test.2015-09-01.0.log", zis.getNextEntry().getName());
+                final String content = IOUtils.toString(zis);
+                assertTrue(content.contains("INFO: abcdefghij\n"));
+                assertEquals(10258, content.length());
+                assertNull(zis.getNextEntry());
+            }
+        }
+    }
+
+    @Test
+    public void logAndRotateAndPurge() throws IOException, NoSuchMethodException {
+        clean("target/ArchivingTestPurge-" + format + "/logs");
+
+        final AtomicReference<String> today = new AtomicReference<>();
+        final Map<String, String> config = new HashMap<>();
+
+        // initial config
+        today.set("2015-09-01");
+        config.put("filenamePattern", "target/ArchivingTestPurge-" + format + "/logs/test.%s.%d.log");
+        config.put("archiveDirectory", "target/ArchivingTestPurge-" + format + "/logs/archives");
+        config.put("archiveFormat", format);
+        config.put("archiveOlderThan", "1 s");
+        config.put("purgeOlderThan", "2 s");
+        config.put("limit", "10 kilobytes");
+        config.put("level", "INFO");
+        config.put("dateCheckInterval", "1 second");
+
+        final LocalFileHandler handler = new LocalFileHandler() {
+            @Override
+            protected String currentDate() {
+                return today.get();
+            }
+
+            @Override
+            protected String getProperty(final String name, final String defaultValue) {
+                final String s = config.get(name.substring(name.lastIndexOf('.') + 1));
+                return s != null ? s : defaultValue;
+            }
+        };
+
+        final String string10chars = "abcdefghij";
+        final int iterations = 950;
+        for (int i = 0; i < iterations; i++) {
+            handler.publish(new LogRecord(Level.INFO, string10chars));
+        }
+
+        final File logArchive = new File("target/ArchivingTestPurge-" + format + "/logs/archives/test.2015-09-01.0.log." + format);
+
+        today.set("2015-09-02");
+        try {
+            Thread.sleep(1500);
+        } catch (final InterruptedException e) {
+            Thread.interrupted();
+        }
+        handler.publish(new LogRecord(Level.INFO, string10chars)); // will trigger the archiving
+        for (int i = 0; i < 120; i++) { // async so retry
+            if (logArchive.exists()) {
+                break;
+            }
+            try {
+                Thread.sleep(250);
+            } catch (final InterruptedException e) {
+                Thread.interrupted();
+            }
+        }
+        assertTrue(logArchive.getAbsolutePath() + " was archived", logArchive.exists());
+
+        today.set("2015-09-03");
+        try {
+            Thread.sleep(2500);
+        } catch (final InterruptedException e) {
+            Thread.interrupted();
+        }
+        handler.publish(new LogRecord(Level.INFO, string10chars)); // will trigger the purging
+        handler.close();
+
+        assertFalse(logArchive.getAbsolutePath() + " was purged", logArchive.exists());
+    }
+
+    private static void clean(final String base) {
+        {
+            final File out = new File(base);
+            if (out.exists()) {
+                for (final File file : asList(out.listFiles(new FileFilter() {
+                    @Override
+                    public boolean accept(final File pathname) {
+                        return pathname.getName().startsWith("test");
+                    }
+                }))) {
+                    file.delete();
+                }
+            }
+        }
+        {
+            final File out = new File(base + "/archives");
+            if (out.exists()) {
+                for (final File file : asList(out.listFiles(new FileFilter() {
+                    @Override
+                    public boolean accept(final File pathname) {
+                        return pathname.getName().startsWith("test");
+                    }
+                }))) {
+                    file.delete();
+                }
+            }
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/af575544/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
new file mode 100644
index 0000000..e17740d
--- /dev/null
+++ b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/LocalFileHandlerTest.java
@@ -0,0 +1,128 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.tomee.jul.handler.rotating;
+
+import org.apache.commons.io.IOUtils;
+import org.junit.Test;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.logging.Formatter;
+import java.util.logging.Level;
+import java.util.logging.LogRecord;
+
+import static java.lang.System.lineSeparator;
+import static java.util.Arrays.asList;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public class LocalFileHandlerTest {
+    @Test
+    public void logAndRotate() throws IOException {
+        final File out = new File("target/LocalFileHandlerTest/logs/");
+        if (out.exists()) {
+            for (final File file : asList(out.listFiles(new FileFilter() {
+                @Override
+                public boolean accept(final File pathname) {
+                    return pathname.getName().startsWith("test");
+                }
+            }))) {
+                file.delete();
+            }
+        }
+
+        final AtomicReference<String> today = new AtomicReference<>();
+        final Map<String, String> config = new HashMap<>();
+
+        // initial config
+        today.set("day1");
+        config.put("filenamePattern", "target/LocalFileHandlerTest/logs/test.%s.%d.log");
+        config.put("limit", "10 kilobytes");
+        config.put("level", "INFO");
+        config.put("dateCheckInterval", "1 second");
+        config.put("formatter", MessageOnlyFormatter.class.getName());
+
+        final LocalFileHandler handler = new LocalFileHandler() {
+            @Override
+            protected String currentDate() {
+                return today.get();
+            }
+
+            @Override
+            protected String getProperty(final String name, final String defaultValue) {
+                final String s = config.get(name.substring(name.lastIndexOf('.') + 1));
+                return s != null ? s : defaultValue;
+            }
+        };
+
+        final String string10chars = "abcdefghij";
+        final int iterations = 950;
+        for (int i = 0; i < iterations; i++) {
+            handler.publish(new LogRecord(Level.INFO, string10chars));
+        }
+
+        final File[] logFiles = out.listFiles(new FileFilter() {
+            @Override
+            public boolean accept(final File pathname) {
+                return pathname.getName().startsWith("test");
+            }
+        });
+        final Set<String> logFilesNames = new HashSet<>();
+        for (final File f : logFiles) {
+            logFilesNames.add(f.getName());
+        }
+        assertEquals(2, logFiles.length);
+        assertEquals(new HashSet<>(asList("test.day1.0.log", "test.day1.1.log")), logFilesNames);
+
+        try (final InputStream is = new FileInputStream(new File(out, "test.day1.1.log"))) {
+            final List<String> lines = IOUtils.readLines(is);
+            assertEquals(19, lines.size());
+            assertEquals(string10chars, lines.iterator().next());
+        }
+
+        final long firstFileLen = new File(out, "test.day1.0.log").length();
+        assertTrue(firstFileLen >= 1024 * 10 && firstFileLen < 1024 * 10 + (1 + string10chars.getBytes().length));
+
+        // now change of day
+        today.set("day2");
+        try { // ensure we tets the date
+            Thread.sleep(1500);
+        } catch (final InterruptedException e) {
+            Thread.interrupted();
+        }
+        handler.publish(new LogRecord(Level.INFO, string10chars));
+        assertTrue(new File(out, "test.day2.0.log").exists());
+
+        handler.close();
+    }
+
+    public static class MessageOnlyFormatter extends Formatter {
+        @Override
+        public String format(final LogRecord record) {
+            return record.getMessage() + lineSeparator();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/tomee/blob/af575544/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/PerfRunner.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/PerfRunner.java b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/PerfRunner.java
new file mode 100644
index 0000000..8ef6644
--- /dev/null
+++ b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/handler/rotating/PerfRunner.java
@@ -0,0 +1,109 @@
+package org.apache.tomee.jul.handler.rotating;
+
+import org.apache.juli.OneLineFormatter;
+import org.openjdk.jmh.annotations.Benchmark;
+import org.openjdk.jmh.annotations.Scope;
+import org.openjdk.jmh.annotations.Setup;
+import org.openjdk.jmh.annotations.State;
+import org.openjdk.jmh.annotations.TearDown;
+import org.openjdk.jmh.runner.Runner;
+import org.openjdk.jmh.runner.RunnerException;
+import org.openjdk.jmh.runner.options.OptionsBuilder;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.logging.Handler;
+import java.util.logging.Logger;
+
+/*
+#1 thread
+Benchmark                     Mode  Cnt      Score       Error  Units
+PerfRunner.bufferizedLogger  thrpt    5  70875.992 ± 14974.425  ops/s
+PerfRunner.defaultLogger     thrpt    5  54832.426 ± 11709.029  ops/s
+
+#30 threads
+Benchmark                     Mode  Cnt       Score        Error  Units
+PerfRunner.bufferizedLogger  thrpt    5  123684.947 ± 103294.959  ops/s
+PerfRunner.defaultLogger     thrpt    5   62014.127 ±  36682.710  ops/s
+ */
+@State(Scope.Benchmark)
+public class PerfRunner {
+    private Logger defaultLogger;
+    private Logger bufferizedLogger;
+
+    @Setup
+    public void setup() {
+        {
+            defaultLogger = Logger.getLogger("perf.logger.default");
+            cleanHandlers(defaultLogger);
+
+            final Map<String, String> config = new HashMap<>();
+
+            // initial config
+            config.put("filenamePattern", "target/PerfRunner/logs/performance.default.%s.%02d.log");
+            config.put("limit", "10 Mega");
+            config.put("formatter", OneLineFormatter.class.getName());
+            defaultLogger.addHandler(new LocalFileHandler() {
+                @Override
+                protected String getProperty(final String name, final String defaultValue) {
+                    final String key = name.substring(name.lastIndexOf('.') + 1);
+                    return config.containsKey(key) ? config.get(key) : defaultValue;
+                }
+            });
+        }
+        {
+            bufferizedLogger = Logger.getLogger("perf.logger.buffer");
+            cleanHandlers(bufferizedLogger);
+
+            final Map<String, String> config = new HashMap<>();
+
+            // initial config
+            config.put("filenamePattern", "target/PerfRunner/logs/performance.buffer.%s.%02d.log");
+            config.put("limit", "10 Mega");
+            config.put("bufferSize", "1 Mega");
+            config.put("formatter", OneLineFormatter.class.getName());
+            bufferizedLogger.addHandler(new LocalFileHandler() {
+                @Override
+                protected String getProperty(final String name, final String defaultValue) {
+                    final String key = name.substring(name.lastIndexOf('.') + 1);
+                    return config.containsKey(key) ? config.get(key) : defaultValue;
+                }
+            });
+        }
+    }
+
+    @TearDown
+    public void tearDown() {
+        defaultLogger.getHandlers()[0].close();
+        bufferizedLogger.getHandlers()[0].close();
+    }
+
+    private void cleanHandlers(final Logger logger) {
+        for (final Handler h : logger.getHandlers()) {
+            logger.removeHandler(h);
+        }
+        logger.setUseParentHandlers(false);
+    }
+
+    @Benchmark
+    public void defaultLogger() {
+        defaultLogger.info("something happens here and nowhere else so i need to write it down");
+    }
+
+
+    @Benchmark
+    public void bufferizedLogger() {
+        bufferizedLogger.info("something happens here and nowhere else so i need to write it down");
+    }
+
+    public static void main(final String[] args) throws RunnerException {
+        new Runner(new OptionsBuilder()
+            .include(PerfRunner.class.getSimpleName())
+            .forks(0)
+            .warmupIterations(5)
+            .measurementIterations(5)
+            .threads(1)
+            .build())
+            .run();
+    }
+}