tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject tomee git commit: TOMEE-1856 avoid to create empty log files with AsyncConsoleHandler
Date Sat, 02 Jul 2016 14:26:46 GMT
Repository: tomee
Updated Branches:
  refs/heads/master dc2b7374e -> 3a73f9445


TOMEE-1856 avoid to create empty log files with AsyncConsoleHandler


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

Branch: refs/heads/master
Commit: 3a73f94458186bef1e8093615d8d8b0e1d998732
Parents: dc2b737
Author: Romain manni-Bucau <rmannibucau@gmail.com>
Authored: Sat Jul 2 16:26:25 2016 +0200
Committer: Romain manni-Bucau <rmannibucau@gmail.com>
Committed: Sat Jul 2 16:26:25 2016 +0200

----------------------------------------------------------------------
 .../jul/formatter/AsyncConsoleHandler.java      | 25 +++++++++++++++
 .../jul/formatter/AsyncConsoleHandlerTest.java  | 32 ++++++++++++++++++++
 2 files changed, 57 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/3a73f944/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 4dd2554..20b4d60 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
@@ -33,6 +33,31 @@ public class AsyncConsoleHandler extends AsyncFileHandler {
         delegate.publish(record);
     }
 
+    @Override
+    public void close() {
+        delegate.close();
+    }
+
+    @Override
+    public void flush() {
+        delegate.flush();
+    }
+
+    @Override
+    protected void open() {
+        // no-op
+    }
+
+    @Override
+    protected void closeWriter() {
+        // no-op
+    }
+
+    @Override
+    protected void openWriter() {
+        // no-op
+    }
+
     // copy cause of classloading
     private static class SingleLineFormatter extends Formatter {
         private static final String SEP = System.getProperty("line.separator", "\n");

http://git-wip-us.apache.org/repos/asf/tomee/blob/3a73f944/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/formatter/AsyncConsoleHandlerTest.java
----------------------------------------------------------------------
diff --git a/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/formatter/AsyncConsoleHandlerTest.java
b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/formatter/AsyncConsoleHandlerTest.java
new file mode 100644
index 0000000..ea60128
--- /dev/null
+++ b/tomee/tomee-juli/src/test/java/org/apache/tomee/jul/formatter/AsyncConsoleHandlerTest.java
@@ -0,0 +1,32 @@
+/*
+ * 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.junit.Test;
+
+import java.io.File;
+
+import static org.junit.Assert.assertFalse;
+
+public class AsyncConsoleHandlerTest {
+    @Test
+    public void dontCreateEmptyFile() {
+        assertFalse(new File("logs").isDirectory());
+        new AsyncConsoleHandler();
+        assertFalse(new File("logs").isDirectory());
+    }
+}


Mime
View raw message