Package org.jboss.logmanager.handlers

Examples of org.jboss.logmanager.handlers.FileHandler


    public synchronized String getEncoding() {
        return encoding;
    }

    public synchronized void setEncoding(final String encoding) throws UnsupportedEncodingException {
        final FileHandler handler = value;
        if (handler != null) handler.setEncoding(encoding);
        this.encoding = encoding;
    }
View Full Code Here


        return append;
    }

    public synchronized void setAppend(final boolean append) {
        this.append = append;
        final FileHandler handler = value;
        if (handler != null) handler.setAppend(append);
    }
View Full Code Here

        final FileHandler handler = value;
        if (handler != null) handler.setAppend(append);
    }

    private void setFileName() throws FileNotFoundException {
        final FileHandler handler = value;
        if (handler == null) {
            return;
        }
        final String value = relativeTo.getOptionalValue();
        final String fileName = value != null ? value + "/" + path : path;
        handler.setFileName(fileName);
    }
View Full Code Here

      if(logName == null)
      {
        logName = deployment; // default log name
      }
     
      FileHandler fileHandler = fileHandlers.get(logName);
      if(fileHandler == null)
      {
        fileHandler = createFileHandler(logName);
      }
      fileHandler.publish(record);

      // TODO why is this here?
      if(!fileHandler.isAutoFlush())
      {
        fileHandler.flush();
      }
    }
    finally
    {
      invoked.set(Boolean.FALSE);
View Full Code Here

  {
    try
    {
      // TODO add ability to rotate
      File f = new File(dirName + File.separator + logName + ".log");
      FileHandler newHandler = new FileHandler(getFormatter(), f);
      fileHandlers.put(logName, newHandler);
      return newHandler;
    }
    catch(FileNotFoundException e)
    {
View Full Code Here

*/
public final class FileHandlerService extends AbstractFileHandlerService<FileHandler> {

    @Override
    protected FileHandler createHandler() throws StartException {
        return new FileHandler();
    }
View Full Code Here

    private String encoding;
    private boolean append;
    private FileHandler value;

    public synchronized void start(final StartContext context) throws StartException {
        final FileHandler handler = new FileHandler();
        value = handler;
        if (filter != null) handler.setFilter(filter);
        formatterSpec.apply(handler);
        if (level != null) handler.setLevel(level);
        handler.setAutoFlush(autoflush);
        try {
            handler.setEncoding(encoding);
        } catch (UnsupportedEncodingException e) {
            throw new StartException(e);
        }
        handler.setAppend(append);
        try {
            handler.setFileName(fileName.getValue());
        } catch (FileNotFoundException e) {
            throw new StartException(e);
        }
        value = handler;
    }
View Full Code Here

        }
        value = handler;
    }

    public synchronized void stop(final StopContext context) {
        final FileHandler handler = value;
        handler.close();
        value = null;
    }
View Full Code Here

        return level;
    }

    public synchronized void setLevel(final Level level) {
        this.level = level;
        final FileHandler handler = value;
        if (handler != null) handler.setLevel(level);
    }
View Full Code Here

        return formatterSpec;
    }

    public synchronized void setFormatterSpec(final FormatterSpec formatterSpec) {
        this.formatterSpec = formatterSpec;
        final FileHandler handler = value;
        if (handler != null) formatterSpec.apply(handler);
    }
View Full Code Here

TOP

Related Classes of org.jboss.logmanager.handlers.FileHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.