public static void initLog4j2WithoutConfigFile() {
		System.out.println("no local log4j2.xml file found,init logContext");
		
		ConfigurationBuilder< BuiltConfiguration > builder =
		        ConfigurationBuilderFactory.newConfigurationBuilder();

		builder.setStatusLevel( Level.ERROR);
		builder.setConfigurationName("RollingBuilder");
		// create the console appender
		AppenderComponentBuilder appenderBuilder = builder.newAppender("Stdout", "CONSOLE").addAttribute("target",
		        ConsoleAppender.Target.SYSTEM_OUT);
		appenderBuilder.add(builder.newLayout("PatternLayout").
		        addAttribute("pattern", "%d [%t] %-5level: %msg%n%throwable"));
		builder.add( appenderBuilder );

//		LayoutComponentBuilder layoutBuilder = builder.newLayout("PatternLayout")
//		        .addAttribute("pattern", "%d [%t] %-5level: %msg%n");
//		ComponentBuilder triggeringPolicy = builder.newComponent("Policies")
//		        .addComponent(builder.newComponent("CronTriggeringPolicy").addAttribute("schedule", "0 0 0 * * ?"))
//		        .addComponent(builder.newComponent("SizeBasedTriggeringPolicy").addAttribute("size", "100M"));
//		appenderBuilder = builder.newAppender("rolling", "RollingFile")
//		        .addAttribute("fileName", "target/rolling.log")
//		        .addAttribute("filePattern", "target/archive/rolling-%d{MM-dd-yy}.log.gz")
//		        .add(layoutBuilder)
//		        .addComponent(triggeringPolicy);
//		builder.add(appenderBuilder);

		builder.add(builder.newRootLogger(Level.INFO).add(builder.newAppenderRef("Stdout")));
		builder.add(builder.newLogger("com.jeesuite", Level.TRACE).add(builder.newAppenderRef("Stdout")).addAttribute("additivity", false));
		 
		Configurator.initialize(builder.build());
	}
public static void initLog4j2WithoutConfigFile ( ) { System . out . println ( "no local log4j2.xml file found,init logContext" ) ; ConfigurationBuilder < BuiltConfiguration > builder = ConfigurationBuilderFactory . newConfigurationBuilder ( ) ; builder . setStatusLevel ( Level . ERROR ) ; builder . setConfigurationName ( "RollingBuilder" ) ; AppenderComponentBuilder appenderBuilder = builder . newAppender ( "Stdout" , "CONSOLE" ) . addAttribute ( "target" , ConsoleAppender . Target . SYSTEM_OUT ) ; appenderBuilder . add ( builder . newLayout ( "PatternLayout" ) . addAttribute ( "pattern" , "%d [%t] %-5level: %msg%n%throwable" ) ) ; builder . add ( appenderBuilder ) ; builder . add ( builder . newRootLogger ( Level . INFO ) . add ( builder . newAppenderRef ( "Stdout" ) ) ) ; builder . add ( builder . newLogger ( "com.jeesuite" , Level . TRACE ) . add ( builder . newAppenderRef ( "Stdout" ) ) . addAttribute ( "additivity" , false ) ) ; Configurator . initialize ( builder . build ( ) ) ; }
初始化日志配置