Examples of Appender


Examples of ch.qos.logback.core.Appender

      return;
    }

    HashMap appenderBag = (HashMap) ec.getObjectMap().get(
        ActionConst.APPENDER_BAG);
    Appender appender = (Appender) appenderBag.get(appenderName);

    if (appender == null) {
      String msg = "Could not find an appender named [" + appenderName
          + "]. Did you define it below in the config file?";
      inError = true;
View Full Code Here

Examples of org.apache.log4j.Appender

    return options;
  }
 
  public void execute(String commandName, final ConsoleInput ci, CommandLine commandLine)
  {
    Appender con = Logger.getRootLogger().getAppender("ConsoleAppender");
    List args = commandLine.getArgList();
    if ((con != null) && (!args.isEmpty())) {
      String subcommand = (String) args.get(0);
      if ("off".equalsIgnoreCase(subcommand) ) {
        if ( args.size() == 1 ){
          con.addFilter(new DenyAllFilter());
          ci.out.println("> Console logging off");
        }else{
         
          String  name = (String)args.get(1);
         
          Object[]  entry  = (Object[])channel_listener_map.remove( name );
         
          if ( entry == null ){
           
            ci.out.println( "> Channel '" + name + "' not being logged" );
           
          }else{
           
            ((LoggerChannel)entry[0]).removeListener((LoggerChannelListener)entry[1]);
           
            ci.out.println( "> Channel '" + name + "' logging off" );
          }
        }
      } else if ("on".equalsIgnoreCase(subcommand) ) {
       
        if ( args.size() == 1 ){

          if( commandLine.hasOption('f') )
          {
            // send log output to a file
            String filename = commandLine.getOptionValue('f');
           
            try
            {
              Appender newAppender = new FileAppender(new PatternLayout("%d{ISO8601} %c{1}-%p: %m%n"), filename, true);
              newAppender.setName("ConsoleAppender");
              Logger.getRootLogger().removeAppender(con);
              Logger.getRootLogger().addAppender(newAppender);
              ci.out.println("> Logging to filename: " + filename);
            } catch (IOException e)
            {
View Full Code Here

Examples of org.apache.log4j.Appender

    return commands;
  }
 
  public static void initRootLogger() {
    if (Logger.getRootLogger().getAppender("ConsoleAppender")==null) {
      Appender app;
      app = new ConsoleAppender(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN));
      app.setName("ConsoleAppender");
      app.addFilter( new DenyAllFilter() )//'log off' by default
      Logger.getRootLogger().addAppender(app);
    }
  }
View Full Code Here

Examples of org.apache.log4j.Appender

    this.userProfile   = UserProfile.DEFAULT_USER_PROFILE;
    this.controlling   = false;
    this.br       = new CommandReader( new InputStreamReader( new ByteArrayInputStream(new byte[0])));
       
    if (Logger.getRootLogger().getAppender("ConsoleAppender")==null) {
        Appender app;
        app = new ConsoleAppender(new PatternLayout(PatternLayout.TTCC_CONVERSION_PATTERN));
        app.setName("ConsoleAppender");
        app.addFilter( new DenyAllFilter() )//'log off' by default
        Logger.getRootLogger().addAppender(app);
      }
   
    initialise();
  }
View Full Code Here

Examples of org.apache.log4j.Appender

                // Initialize the Component factory
                new ComponentFactory();
               
                Enumeration en = Logger.getRootLogger().getAllAppenders();
                while (en.hasMoreElements()) {
                    Appender appender = (Appender) en.nextElement();
                    if (appender instanceof TextPaneAppender)
                        ((TextPaneAppender) appender).addListener(LogPanel.getInstance());
                }            
       
                logger.info(DcResources.getText("msgApplicationStarts"));
View Full Code Here

Examples of org.apache.log4j.Appender

    private void shutdownLogger()
    {
        Enumeration appenders = logger.getAllAppenders();
        while (appenders.hasMoreElements())
        {
            Appender appender = (Appender) appenders.nextElement();
            if (appender.getName() != null)
            {
                appender.close();
            }
        }
    }
View Full Code Here

Examples of org.apache.log4j.Appender

   */
  public void printEndTag(PageRequest request, PageResponse response)
    throws RegainException
  {
    if (mMemoryAppender == null) {
      Appender app = (MemoryAppender) Logger.getRootLogger().getAppender("memory");
      if (app instanceof MemoryAppender) {
        mMemoryAppender = (MemoryAppender) app;
      } else {
        response.print("No MemoryAppender with the name 'memory' configured!");
        return;
View Full Code Here

Examples of org.apache.log4j.Appender

  public static void setLogLevelAndAppender(String configStr) {
    StringTokenizer st = new StringTokenizer(configStr, "=");
    String anIpAddress = st.nextToken();
    String logConfig = st.nextToken();
    Level level;
    Appender appender;
    if (logConfig.contains(",")) {
      st = new StringTokenizer(logConfig, ",");
      level = Level.toLevel(st.nextToken());
      String categoryAppenderStr = st.nextToken();
      Logger l = Logger.getLogger(categoryAppenderStr);
View Full Code Here

Examples of org.apache.log4j.Appender

  public static void setLogLevelAndAppender(String configStr) {
    StringTokenizer st = new StringTokenizer(configStr, "=");
    String username = st.nextToken();
    String logConfig = st.nextToken();
    Level level;
    Appender appender;
    if (logConfig.contains(",")) {
      st = new StringTokenizer(logConfig, ",");
      level = Level.toLevel(st.nextToken());
      String categoryAppenderStr = st.nextToken();
      Logger l = Logger.getLogger(categoryAppenderStr);
View Full Code Here

Examples of org.apache.log4j.Appender

   * @param message the message which should be logged (or not, depending on levels)
   */
  private final void threadLocalAwareLog(String fQCN, Priority priority, Object message, Throwable t) {
    if (isForcedToLog(priority)) {

      final Appender forcedAppender = getForcedAppender();
     
      // force the logging and modify the log message (the latter might return the original message)
      if (forcedAppender!=null) {
        // only call the forced appender
        forcedAppender.doAppend(new LoggingEvent(fQCN, this, priority, modifyLogMessage(message), t));
      } else {
        // go via the normal appenders
        forcedLog(fQCN, priority, modifyLogMessage(message), t);
      }
   
View Full Code Here
TOP
Copyright © 2015 www.massapi.com. 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.