Package org.apache.log4j

Examples of org.apache.log4j.Layout


        }
    }

    private void prepareServerLog(File log)
            throws IOException {
        Layout layout =
            new PatternLayout("%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m%n");

        Logger jackrabbitLog = Logger.getRootLogger();
        jackrabbitLog.addAppender(new FileAppender(
                layout, new File(log, "jackrabbit.log").getPath()));
View Full Code Here


  Layout parseLayout (Element layout_element) {
    String className = subst(layout_element.getAttribute(CLASS_ATTR));
    LogLog.debug("Parsing layout of class: \""+className+"\"");    
    try {
      Object instance   = Class.forName(className).newInstance();
      Layout layout     = (Layout)instance;
      PropertySetter propSetter = new PropertySetter(layout);
     
      NodeList params   = layout_element.getChildNodes();
      final int length   = params.getLength();
View Full Code Here

  static
  void ProgramInit(String layoutType) {

    Appender appender = null
    Layout layout = null;
       
    if(layoutType.equals("simple"))
      layout = new SimpleLayout();
    else if(layoutType.equals("ttcc")) {
      layout = new TTCCLayout(AbsoluteTimeDateFormat.DATE_AND_TIME_DATE_FORMAT);
View Full Code Here

  Layout parseLayout (Element layout_element) {
    String className = layout_element.getAttribute(CLASS_ATTR);
    LogLog.debug("Parsing layout of class: \""+className+"\"");    
    try {
      Object instance   = Class.forName(className).newInstance();
      Layout layout     = (Layout)instance;
     
      NodeList params   = layout_element.getChildNodes();
      final int length   = params.getLength();

      for (int loop = 0; loop < length; loop++) {
  Node currentNode = (Node)params.item(loop);
  if (currentNode.getNodeType() == Node.ELEMENT_NODE) {
    Element currentElement = (Element) currentNode;
    String tagName = currentElement.getTagName();
    if(tagName.equals(PARAM_TAG)) {
      parseParameters(currentElement, layout);
    }
  }
      }

      /* Now make those options take effect */
      layout.activateOptions();
      return layout;
    }
    catch (Exception oops) {
      LogLog.error("Could not create the Layout. Reported error follows.",
       oops);
View Full Code Here

                    Logger p2 = null;
                    while ((p2 = (Logger) p1.getParent()) != null) {
                        p1 = p2;
                    }

                    Layout layout = new PatternLayout(
                            "CayenneModeler %-5p [%t %d{MM-dd HH:mm:ss}] %c: %m%n");
                    p1.removeAllAppenders();
                    p1.addAppender(new FileAppender(
                            layout,
                            logfile.getCanonicalPath(),
View Full Code Here

        message("The repository has been successfully copied.");
    }

    private void prepareServerLog(File log)
            throws IOException {
        Layout layout =
            new PatternLayout("%d{dd.MM.yyyy HH:mm:ss} *%-5p* %c{1}: %m%n");

        Logger jackrabbitLog = Logger.getRootLogger();
        jackrabbitLog.addAppender(new FileAppender(
                layout, new File(log, "jackrabbit.log").getPath()));
View Full Code Here

  @Test(timeout=20000)
  public void testWarnCommandOpts() throws Exception {
    Logger logger = Logger.getLogger(YARNRunner.class);
   
    ByteArrayOutputStream bout = new ByteArrayOutputStream();
    Layout layout = new SimpleLayout();
    Appender appender = new WriterAppender(layout, bout);
    logger.addAppender(appender);
   
    JobConf jobConf = new JobConf();
   
View Full Code Here

   * @throws IOException
   * @throws Exception
   */
  public static void setupLogging(Properties props, String logFile)
                                    throws LinkBenchConfigError, IOException {
    Layout fmt = new EnhancedPatternLayout("%p %d [%t]: %m%n%throwable{30}");
    Level logLevel = ConfigUtil.getDebugLevel(props);
    Logger.getRootLogger().removeAllAppenders();
    Logger lbLogger = Logger.getLogger(LINKBENCH_LOGGER);
    lbLogger.setLevel(logLevel);
    ConsoleAppender console = new ConsoleAppender(fmt, "System.err");
View Full Code Here

    public CollectionConfigurationValidationModeTest() {
    }
   
    public static void initLog4J(){
        Layout layout = new PatternLayout("%d [%t] %-5p (%F [%M]:%L) - %m %n");
        Appender appender=new ConsoleAppender(layout);
        BasicConfigurator.configure(appender);      
    }
View Full Code Here

    public CollectionConfigurationTest() {
    }

    public static void initLog4J() {
        Layout layout = new PatternLayout("%d [%t] %-5p (%F [%M]:%L) - %m %n");
        Appender appender = new ConsoleAppender(layout);
        BasicConfigurator.configure(appender);
    }
View Full Code Here

TOP

Related Classes of org.apache.log4j.Layout

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.