You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by an...@apache.org on 2013/08/16 15:13:45 UTC
svn commit: r1514692 - in
/jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging:
FmtLog.java Log.java
Author: andy
Date: Fri Aug 16 13:13:45 2013
New Revision: 1514692
URL: http://svn.apache.org/r1514692
Log:
Move log operations with formating to a separate class because of (silent)
conflict with resolving operations of same name and compatible arguments.
Added:
jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/FmtLog.java
Modified:
jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/Log.java
Added: jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/FmtLog.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/FmtLog.java?rev=1514692&view=auto
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/FmtLog.java (added)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/FmtLog.java Fri Aug 16 13:13:45 2013
@@ -0,0 +1,69 @@
+/**
+ * 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.jena.atlas.logging;
+
+import java.util.IllegalFormatException ;
+
+import org.slf4j.Logger ;
+
+public class FmtLog {
+
+ // -- Delayed argument formatting.
+ /* Log at 'trace' level. */
+ public static void trace(Logger log, String fmt, Object...args) {
+ if ( log.isTraceEnabled() )
+ log.trace(format(fmt, args)) ;
+ }
+
+ /* Log at 'debug' level */
+ public static void debug(Logger log, String fmt, Object...args) {
+ if ( log.isDebugEnabled() )
+ log.debug(format(fmt, args)) ;
+ }
+
+ /* Log at 'info' level */
+ public static void info(Logger log, String fmt, Object...args) {
+ if ( log.isInfoEnabled() )
+ log.info(format(fmt, args)) ;
+ }
+
+ /* Log at 'warn' level */
+ public static void warn(Logger log, String fmt, Object...args) {
+ if ( log.isWarnEnabled() )
+ log.warn(format(fmt, args)) ;
+ }
+
+ /* Log at 'error' level */
+ public static void error(Logger log, String fmt, Object...args) {
+ if ( log.isErrorEnabled() )
+ log.error(format(fmt, args)) ;
+ }
+
+ private static String format(String fmt, Object[] args) {
+ try {
+ return String.format(fmt, args) ;
+ } catch (IllegalFormatException ex) {
+ // return something, however grotty.
+ return fmt+" "+args ;
+ }
+ }
+ // ----
+
+}
+
Modified: jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/Log.java
URL: http://svn.apache.org/viewvc/jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/Log.java?rev=1514692&r1=1514691&r2=1514692&view=diff
==============================================================================
--- jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/Log.java (original)
+++ jena/trunk/jena-arq/src/main/java/org/apache/jena/atlas/logging/Log.java Fri Aug 16 13:13:45 2013
@@ -23,7 +23,6 @@ import java.io.File ;
import java.io.FileInputStream ;
import java.io.IOException ;
import java.io.InputStream ;
-import java.util.IllegalFormatException ;
import java.util.Properties ;
import org.apache.jena.atlas.AtlasException ;
@@ -44,47 +43,6 @@ public class Log
{
private Log() {}
- // -- Delayed argument formatting.
- /* Log at 'trace' level. */
- public static void trace(Logger log, String fmt, Object...args) {
- if ( log.isTraceEnabled() )
- log.trace(format(fmt, args)) ;
- }
-
- /* Log at 'debug' level */
- public static void debug(Logger log, String fmt, Object...args) {
- if ( log.isDebugEnabled() )
- log.debug(format(fmt, args)) ;
- }
-
- /* Log at 'info' level */
- public static void info(Logger log, String fmt, Object...args) {
- if ( log.isInfoEnabled() )
- log.info(format(fmt, args)) ;
- }
-
- /* Log at 'warn' level */
- public static void warn(Logger log, String fmt, Object...args) {
- if ( log.isWarnEnabled() )
- log.warn(format(fmt, args)) ;
- }
-
- /* Log at 'error' level */
- public static void error(Logger log, String fmt, Object...args) {
- if ( log.isErrorEnabled() )
- log.error(format(fmt, args)) ;
- }
-
- private static String format(String fmt, Object[] args) {
- try {
- return String.format(fmt, args) ;
- } catch (IllegalFormatException ex) {
- // return something, however grotty.
- return fmt+" "+args ;
- }
- }
- // ----
-
static public void info(String caller, String msg)
{
log(caller).info(msg) ;