diff options
Diffstat (limited to 'src/uk/ac/ox/cs/pagoda/util/Utility.java')
| -rw-r--r-- | src/uk/ac/ox/cs/pagoda/util/Utility.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/uk/ac/ox/cs/pagoda/util/Utility.java b/src/uk/ac/ox/cs/pagoda/util/Utility.java index 6d50ee0..b3a4df1 100644 --- a/src/uk/ac/ox/cs/pagoda/util/Utility.java +++ b/src/uk/ac/ox/cs/pagoda/util/Utility.java | |||
| @@ -1,5 +1,6 @@ | |||
| 1 | package uk.ac.ox.cs.pagoda.util; | 1 | package uk.ac.ox.cs.pagoda.util; |
| 2 | 2 | ||
| 3 | import org.apache.log4j.Level; | ||
| 3 | import org.apache.log4j.Logger; | 4 | import org.apache.log4j.Logger; |
| 4 | import org.semanticweb.HermiT.model.Atom; | 5 | import org.semanticweb.HermiT.model.Atom; |
| 5 | 6 | ||
| @@ -11,7 +12,11 @@ import java.util.*; | |||
| 11 | 12 | ||
| 12 | public class Utility { | 13 | public class Utility { |
| 13 | 14 | ||
| 14 | private static final Logger LOGS = Logger.getLogger("PAGOdA"); | 15 | private static Logger LOGS; |
| 16 | static { | ||
| 17 | LOGS = Logger.getLogger("PAGOdA"); | ||
| 18 | LOGS.setLevel(Level.INFO); | ||
| 19 | } | ||
| 15 | 20 | ||
| 16 | public static final String JAVA_FILE_SEPARATOR = "/"; | 21 | public static final String JAVA_FILE_SEPARATOR = "/"; |
| 17 | public static final String FILE_SEPARATOR = System.getProperty("file.separator"); | 22 | public static final String FILE_SEPARATOR = System.getProperty("file.separator"); |
| @@ -184,7 +189,7 @@ public class Utility { | |||
| 184 | } | 189 | } |
| 185 | 190 | ||
| 186 | private static StringBuilder logMessage = new StringBuilder(); | 191 | private static StringBuilder logMessage = new StringBuilder(); |
| 187 | 192 | ||
| 188 | private static String getLogMessage(Object[] messages) { | 193 | private static String getLogMessage(Object[] messages) { |
| 189 | if (messages.length == 1) return messages[0].toString(); | 194 | if (messages.length == 1) return messages[0].toString(); |
| 190 | else { | 195 | else { |
| @@ -198,7 +203,11 @@ public class Utility { | |||
| 198 | } | 203 | } |
| 199 | 204 | ||
| 200 | } | 205 | } |
| 201 | 206 | ||
| 207 | public static void setLogLevel(Level level) { | ||
| 208 | LOGS.setLevel(level); | ||
| 209 | } | ||
| 210 | |||
| 202 | public static void logInfo(Object... messages) { | 211 | public static void logInfo(Object... messages) { |
| 203 | if (LOGS != null) | 212 | if (LOGS != null) |
| 204 | LOGS.info(getLogMessage(messages)); | 213 | LOGS.info(getLogMessage(messages)); |
