Search in sources :

Example 1 with JavaLoggerFormatter

use of org.apache.ignite.logger.java.JavaLoggerFormatter in project ignite by apache.

the class CommandHandler method setupJavaLogger.

/**
 * @return prepared JULs logger.
 */
private Logger setupJavaLogger() {
    Logger result = initLogger(CommandHandler.class.getName() + "Log");
    // Adding logging to file.
    try {
        String absPathPattern = new File(JavaLoggerFileHandler.logDirectory(U.defaultWorkDirectory()), "control-utility-%g.log").getAbsolutePath();
        FileHandler fileHandler = new FileHandler(absPathPattern, 5 * 1024 * 1024, 5);
        fileHandler.setFormatter(new JavaLoggerFormatter());
        result.addHandler(fileHandler);
    } catch (Exception e) {
        System.out.println("Failed to configure logging to file");
    }
    // Adding logging to console.
    result.addHandler(setupStreamHandler());
    return result;
}
Also used : JavaLoggerFormatter(org.apache.ignite.logger.java.JavaLoggerFormatter) Logger(java.util.logging.Logger) File(java.io.File) GridClientHandshakeException(org.apache.ignite.internal.client.GridClientHandshakeException) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) GridClientConnectionResetException(org.apache.ignite.internal.client.impl.connection.GridClientConnectionResetException) GridClientDisconnectedException(org.apache.ignite.internal.client.GridClientDisconnectedException) GridServerUnreachableException(org.apache.ignite.internal.client.GridServerUnreachableException) GridClientAuthenticationException(org.apache.ignite.internal.client.GridClientAuthenticationException) GridClientClosedException(org.apache.ignite.internal.client.GridClientClosedException) FileHandler(java.util.logging.FileHandler) JavaLoggerFileHandler(org.apache.ignite.logger.java.JavaLoggerFileHandler)

Aggregations

File (java.io.File)1 FileHandler (java.util.logging.FileHandler)1 Logger (java.util.logging.Logger)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 GridClientAuthenticationException (org.apache.ignite.internal.client.GridClientAuthenticationException)1 GridClientClosedException (org.apache.ignite.internal.client.GridClientClosedException)1 GridClientDisconnectedException (org.apache.ignite.internal.client.GridClientDisconnectedException)1 GridClientHandshakeException (org.apache.ignite.internal.client.GridClientHandshakeException)1 GridServerUnreachableException (org.apache.ignite.internal.client.GridServerUnreachableException)1 GridClientConnectionResetException (org.apache.ignite.internal.client.impl.connection.GridClientConnectionResetException)1 JavaLoggerFileHandler (org.apache.ignite.logger.java.JavaLoggerFileHandler)1 JavaLoggerFormatter (org.apache.ignite.logger.java.JavaLoggerFormatter)1