Java Code Examples for org.apache.log4j.PropertyConfigurator

The following examples show how to use org.apache.log4j.PropertyConfigurator. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
@Override
public void start(Stage primaryStage) throws Exception {
    PropertyConfigurator.configure(getLog4jProperties());
    ResourceBundle resourceBundle = getBundle();

    initializeDefaultExceptionHandler(resourceBundle);

    primaryStage.setTitle(resourceBundle.getString("primaryStage.title"));
    primaryStage.getIcons().add(new Image(OfflineAdminApp.class.getResourceAsStream("images/icon.gif")));

    BorderPane rootLayout = initRootLayout(resourceBundle);
    Scene mainScene = new Scene(rootLayout);
    mainScene.getStylesheets().add(getStyleSheet().toExternalForm());

    primaryStage.setScene(mainScene);
    primaryStage.show();
}
 
Example 2
Source Project: gemfirexd-oss   Source File: DatabaseTaskBase.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Initializes the logging.
 */
private void initLogging()
{
    if (_simpleLogging)
    {
        // For Ant, we're forcing DdlUtils to do logging via log4j to the console
        Properties props = new Properties();
        String     level = (_verbosity == null ? Level.INFO.toString() : _verbosity.getValue()).toUpperCase();

        props.setProperty("log4j.rootCategory", level + ",A");
        props.setProperty("log4j.appender.A", "org.apache.log4j.ConsoleAppender");
        props.setProperty("log4j.appender.A.layout", "org.apache.log4j.PatternLayout");
        props.setProperty("log4j.appender.A.layout.ConversionPattern", "%m%n");
        // we don't want debug logging from Digester
        props.setProperty("log4j.logger.org.apache.commons", "WARN");

        LogManager.resetConfiguration();
        PropertyConfigurator.configure(props);
    }
    _log = LogFactory.getLog(getClass());
}
 
Example 3
Source Project: MET-CS665   Source File: Main.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This main method runs an example.
 * 
 * @param args not used
 */
public static void main(String[] args) {
  // It should be passed better by the JVM arguments.
  // Like -Dlog4j.configuration={path to the log4j.properties config file}
  PropertyConfigurator.configure("log4j.properties");


  TaxpayerBundle bundleCpa = TaxpayerFactory.createTaxpayerInstance("CPA", "Joe Smith");
  logger.info(bundleCpa.getTaxpayerDetails().getTaxpayerType() + " bundle is created");
  logger.info("Tax Returns Count: " + bundleCpa.getTaxReturns().size());

  TaxpayerBundle bundleTrustee = TaxpayerFactory.createTaxpayerInstance("Trustee", "Jeff Jones");
  logger.info(bundleTrustee.getTaxpayerDetails().getTaxpayerType() + " bundle is created");
  logger.info("Tax Returns Count: " + bundleTrustee.getTaxReturns().size());

  // This line should generate an ERROR in Log
  TaxpayerBundle bundleUnknown = TaxpayerFactory.createTaxpayerInstance("Unknown", "Smith J");
  if (bundleUnknown == null) {
    logger.error("Bunder Account is null!");;
  }

}
 
Example 4
Source Project: MET-CS665   Source File: Main.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * This main method runs an example.
 *
 * @param args not used
 */
public static void main(String[] args) {

  // TODO
  // NOTE: Setting the log4j property should not be here.
  // It should be passed better by the JVM arguments.
  // Like -Dlog4j.configuration={path to the log4j.properties config file}
  PropertyConfigurator.configure("log4j.properties");

  // creating a different type of order but declaring them from their abstract type
  OrderProcessTemplate onlineOrder = new OnlineOrder();
  OrderProcessTemplate inStoreOrder = new InStoreOrder();
  OrderProcessTemplate cryptoOrder = new CryptoOrder();

  // executing the template method for each order object with their unique implementations.
  onlineOrder.processOrder(19, "debit");
  inStoreOrder.processOrder(7, "cash");
  cryptoOrder.processOrder(2,"bitcoin");

  }
 
Example 5
Source Project: knox   Source File: JdbmQueueTest.java    License: Apache License 2.0 6 votes vote down vote up
@After
public void tearDown() throws IOException {
  if( queue != null ) {
    queue.close();
    queue = null;
  }
  LogManager.shutdown();
  String absolutePath = "target/audit";
  File db = new File( absolutePath + ".db" );
  if( db.exists() ) {
    assertThat( "Failed to delete audit store db file.", db.delete(), is( true ) );
  }
  File lg = new File( absolutePath + ".lg" );
  if( lg.exists() ) {
    assertThat( "Failed to delete audit store lg file.", lg.delete(), is( true ) );
  }
  PropertyConfigurator.configure( ClassLoader.getSystemResourceAsStream( "audit-log4j.properties" ) );
}
 
Example 6
Source Project: Touchstone   Source File: QueryInstantiator.java    License: Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) {
		PropertyConfigurator.configure(".//test//lib//log4j.properties");
		System.setProperty("com.wolfram.jlink.libdir", 
				"C://Program Files//Wolfram Research//Mathematica//10.0//SystemFiles//Links//JLink");
		
//		SchemaReader schemaReader = new SchemaReader();
//		List<Table> tables = schemaReader.read(".//test//input//tpch_schema_sf_1.txt");
//		ConstraintChainsReader constraintChainsReader = new ConstraintChainsReader();
//		List<ConstraintChain> constraintChains = constraintChainsReader.read(".//test//input//tpch_cardinality_constraints_sf_1.txt");
//		ComputingThreadPool computingThreadPool = new ComputingThreadPool(2, 20, 0.00001);
//		QueryInstantiator queryInstantiator = new QueryInstantiator(tables, constraintChains, null, 20, 0.00001, computingThreadPool);
//		queryInstantiator.iterate();
		
		SchemaReader schemaReader = new SchemaReader();
		List<Table> tables = schemaReader.read(".//test//input//function_test_schema_0.txt");
		ConstraintChainsReader constraintChainsReader = new ConstraintChainsReader();
		List<ConstraintChain> constraintChains = constraintChainsReader.read(".//test//input//function_test_cardinality_constraints_0.txt");
		NonEquiJoinConstraintsReader nonEquiJoinConstraintsReader = new NonEquiJoinConstraintsReader();
		List<NonEquiJoinConstraint> nonEquiJoinConstraints = nonEquiJoinConstraintsReader.read(".//test//input//function_test_non_equi_join_0.txt");
//		ComputingThreadPool computingThreadPool = new ComputingThreadPool(1, 20, 0.00001);
		ComputingThreadPool computingThreadPool = new ComputingThreadPool(4, 20, 0.00001);
		QueryInstantiator queryInstantiator = new QueryInstantiator(tables, constraintChains, nonEquiJoinConstraints, 20, 0.00001, computingThreadPool);
		queryInstantiator.iterate();
	}
 
Example 7
Source Project: openprodoc   Source File: PDLog.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * @return the log4j
 */
public static Logger getLogger()
{
if (log4j==null)
    {
    PropertyConfigurator.configure(getPropFile());
    FileOutputStream f;
//            try
//            {
//                f = new FileOutputStream("log4j.prop");
//           f.close();
//            } catch (Exception ex)
//            {
//                System.out.println(ex.getLocalizedMessage());
//            }
    log4j = Logger.getLogger("OpenProdoc");
    if (Debug)
       log4j.setLevel(Level.DEBUG);
    else if (Info)
       log4j.setLevel(Level.INFO);
    else if(Error)
       log4j.setLevel(Level.ERROR);
    }
return log4j;
}
 
Example 8
Source Project: hadoop   Source File: KMSWebApp.java    License: Apache License 2.0 6 votes vote down vote up
private void initLogging(String confDir) {
  if (System.getProperty("log4j.configuration") == null) {
    System.setProperty("log4j.defaultInitOverride", "true");
    boolean fromClasspath = true;
    File log4jConf = new File(confDir, LOG4J_PROPERTIES).getAbsoluteFile();
    if (log4jConf.exists()) {
      PropertyConfigurator.configureAndWatch(log4jConf.getPath(), 1000);
      fromClasspath = false;
    } else {
      ClassLoader cl = Thread.currentThread().getContextClassLoader();
      URL log4jUrl = cl.getResource(LOG4J_PROPERTIES);
      if (log4jUrl != null) {
        PropertyConfigurator.configure(log4jUrl);
      }
    }
    LOG = LoggerFactory.getLogger(KMSWebApp.class);
    LOG.debug("KMS log starting");
    if (fromClasspath) {
      LOG.warn("Log4j configuration file '{}' not found", LOG4J_PROPERTIES);
      LOG.warn("Logging with INFO level to standard output");
    }
  } else {
    LOG = LoggerFactory.getLogger(KMSWebApp.class);
  }
}
 
Example 9
Source Project: happor   Source File: AsyncHttpClient.java    License: MIT License 6 votes vote down vote up
public static void main(String[] args) {
	PropertyConfigurator.configure("conf/log4j.properties");

	AsyncHttpClient client = new AsyncHttpClient();
	DefaultFullHttpRequest request = new DefaultFullHttpRequest(
			HttpVersion.HTTP_1_1, HttpMethod.GET, "/AsyncHttpClient");
	client.sendRequest("127.0.0.1", 8888, request, new Callback() {

		public void onResponse(FullHttpResponse response) {
			// TODO Auto-generated method stub
			System.out.println("AsyncHttpClient onResponse");
		}

		public void onTimeout() {
			// TODO Auto-generated method stub
			System.out.println("AsyncHttpClient onTimeout");
		}

		public void onConnectFail() {
			// TODO Auto-generated method stub
			System.out.println("AsyncHttpClient onConnectFail");
		}

	});
}
 
Example 10
Source Project: migration-tool   Source File: StartMigration.java    License: Apache License 2.0 6 votes vote down vote up
public static void main(String[] args) throws Exception {
	PropertyConfigurator.configureAndWatch("config/log4j.properties", 5000L);
	log.info("\r\n\t      Migration-tool client instance start, [version 1.0-SNAPSHOT] "
			+ "\r\n\t\t host=" + Config.getSetting("host") + " port=" + Config.getSetting("port") 
			+ " ability=" + Config.getSetting("ability") + " thread_num=" + Config.getSetting("thread_num")
			+ "\r\n\t\t\t Copyright (C) 2015 JJF");
	//提前加载驱动
	Class.forName("com.mysql.jdbc.Driver");
	//
	int nThreads = Integer.parseInt(Config.getSetting("thread_num"));
	ExecutorService threadPool = Executors.newFixedThreadPool(nThreads, new NamedThreadFactory("migration"));
	
	for(int i=0; i<nThreads; i++) {
		threadPool.execute(new MigrationTask());
		try {
			//暂停1s是为了 能力值处理
			Thread.sleep(1000);
		} catch (Exception e) {
			log.error("main thread sleep 1000ms error!",e);
		}
	}
}
 
Example 11
Source Project: smslib-v3   Source File: Logger.java    License: Apache License 2.0 6 votes vote down vote up
protected Logger()
{
	if (System.getProperties().getProperty("java.vm.name").equalsIgnoreCase("ikvm.net"))
	{
		File f = new File("log4j.properties");
		if (!f.exists()) log4jLogger = null;
		else
		{
			log4jLogger = org.apache.log4j.Logger.getLogger("smslib");
			PropertyConfigurator.configure("log4j.properties");
		}
	}
	else
	{
		log4jLogger = org.apache.log4j.Logger.getLogger("smslib");
		//PropertyConfigurator.configure("log4j.properties");
	}
}
 
Example 12
Source Project: bigtable-sql   Source File: PreLaunchUpdateApplication.java    License: Apache License 2.0 6 votes vote down vote up
private static void initializeLogger() throws IOException
{
	String logConfigFileName = ApplicationArguments.getInstance().getLoggingConfigFileName();
	if (logConfigFileName != null) {
		PropertyConfigurator.configure(logConfigFileName);
	} else {
		ApplicationFiles appFiles = new ApplicationFiles();
		
		String logMessagePattern = "%-4r [%t] %-5p %c %x - %m%n";
		Layout layout = new PatternLayout(logMessagePattern);
		
		File logsDir = new File(appFiles.getUserSettingsDirectory(), "logs");
		File updateLogFile = new File(logsDir, "updater.log");
		
		FileAppender appender = new FileAppender(layout, updateLogFile.getAbsolutePath());
		
		LoggerController.registerLoggerFactory(new SquirrelLoggerFactory(appender, false));
	}
}
 
Example 13
Source Project: saros   Source File: SarosComponent.java    License: GNU General Public License v2.0 6 votes vote down vote up
private void loadLoggers() {
  final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();

  try {
    // change the context class loader so Log4J will find
    // the SarosLogFileAppender
    Thread.currentThread().setContextClassLoader(SarosComponent.class.getClassLoader());

    PropertyConfigurator.configure(
        SarosComponent.class.getClassLoader().getResource("saros.log4j.properties"));
  } catch (RuntimeException e) {
    LogLog.error("initializing loggers failed", e);
  } finally {
    Thread.currentThread().setContextClassLoader(contextClassLoader);
  }
}
 
Example 14
Source Project: rice   Source File: RiceTestCase.java    License: Educational Community License v2.0 6 votes vote down vote up
/**
    * configures logging using custom properties file if specified, or the default one.
    * Log4j also uses any file called log4.properties in the classpath
    *
    * <p>To configure a custom logging file, set a JVM system property on using -D. For example
    * -Dalt.log4j.config.location=file:/home/me/kuali/test/dev/log4j.properties
    * </p>
    *
    * <p>The above option can also be set in the run configuration for the unit test in the IDE.
    * To avoid log4j using files called log4j.properties that are defined in the classpath, add the following system property:
    * -Dlog4j.defaultInitOverride=true
    * </p>
    * @throws IOException
    */
protected void configureLogging() throws IOException {
       ResourceLoader resourceLoader = new FileSystemResourceLoader();
       String altLog4jConfigLocation = System.getProperty(ALT_LOG4J_CONFIG_LOCATION_PROP);
       Resource log4jConfigResource = null;
       if (!StringUtils.isEmpty(altLog4jConfigLocation)) { 
           log4jConfigResource = resourceLoader.getResource(altLog4jConfigLocation);
       }
       if (log4jConfigResource == null || !log4jConfigResource.exists()) {
           System.out.println("Alternate Log4j config resource does not exist! " + altLog4jConfigLocation);
           System.out.println("Using default log4j configuration: " + DEFAULT_LOG4J_CONFIG);
           log4jConfigResource = resourceLoader.getResource(DEFAULT_LOG4J_CONFIG);
       } else {
           System.out.println("Using alternate log4j configuration at: " + altLog4jConfigLocation);
       }
       Properties p = new Properties();
       p.load(log4jConfigResource.getInputStream());
       PropertyConfigurator.configure(p);
   }
 
Example 15
Source Project: SEAL   Source File: WrapperSavingAsiaTest.java    License: Apache License 2.0 5 votes vote down vote up
@BeforeClass
public static void initLog() throws FileNotFoundException, IOException {
    Properties logging = new Properties();
    logging.load(new FileInputStream(new File("config/log4j.properties")));
    PropertyConfigurator.configure(logging);
    Logger.getLogger(BingAPISearcher.class).debug("Testing debug log");
}
 
Example 16
Source Project: kylin   Source File: FragmentCuboidReaderTest.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception {
    this.createTestMetadata();
    this.baseStorePath = KylinConfig.getInstanceFromEnv().getStreamingIndexPath();
    this.cubeInstance = CubeManager.getInstance(getTestConfig()).reloadCubeQuietly(cubeName);
    this.segmentName = "20171018100000_20171018110000";
    this.parsedStreamingCubeInfo = new ParsedStreamingCubeInfo(cubeInstance);
    this.fragment = new DataSegmentFragment(baseStorePath, cubeName, segmentName, new FragmentId(0));
    PropertyConfigurator.configure("../build/conf/kylin-tools-log4j.properties");
    prepareData();
}
 
Example 17
static public void main(String[] args) throws Exception {
   if(args.length != 5) {
     usage("Wrong number of arguments.");
   }
   
   String tcfBindingName = args[0];
   String topicBindingName = args[1];
   String username = args[2];
   String password = args[3];
   
   
   String configFile = args[4];

   if(configFile.endsWith(".xml")) {
     DOMConfigurator.configure(configFile);
   } else {
     PropertyConfigurator.configure(configFile);
   }
   
   new JMSSink(tcfBindingName, topicBindingName, username, password);

   BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
   // Loop until the word "exit" is typed
   System.out.println("Type \"exit\" to quit JMSSink.");
   while(true){
     String s = stdin.readLine( );
     if (s.equalsIgnoreCase("exit")) {
System.out.println("Exiting. Kill the application if it does not exit "
		   + "due to daemon threads.");
return; 
     }
   } 
 }
 
Example 18
public static void main(String[] args) {
    PropertyConfigurator.configure(BBC.class.getClassLoader().getResourceAsStream("log4j-bbcompiler.properties"));
    
    // Parse the args
    Settings settings = new Settings();
    JCommander jc = new JCommander(settings, args);
    jc.setProgramName("bbc");

    if (settings.help) {
        jc.usage();
        return;
    }

    if (settings.version) {
        System.out.println("bbc " + version);
        return;
    }

    if (settings.files.size() <= 0) {
        System.out.println("Missing input file.");
        return;
    }

    try {
        compile(settings);
    } catch (Exception e) {
        log.error(e.getMessage());
    }
}
 
Example 19
Source Project: healthcare-dicom-dicomweb-adapter   Source File: LogUtil.java    License: Apache License 2.0 5 votes vote down vote up
public static void Log4jToStdout(String level) {
  Properties log4jProperties = new Properties();
  log4jProperties.setProperty("log4j.rootLogger", level + ", console");
  log4jProperties.setProperty("log4j.appender.console", "org.apache.log4j.ConsoleAppender");
  log4jProperties.setProperty("log4j.appender.console.layout", "org.apache.log4j.PatternLayout");
  log4jProperties.setProperty(
      "log4j.appender.console.layout.ConversionPattern", "%-5p %c %x - %m%n");
  // to prevent log spam by stackdriver monitoring
  log4jProperties.setProperty("log4j.logger.io.grpc.netty.shaded.io", "WARN");
  // very spammy otherwise
  log4jProperties.setProperty("log4j.logger.org.eclipse.jetty", "WARN");
  PropertyConfigurator.configure(log4jProperties);
}
 
Example 20
Source Project: migration-tool   Source File: StartServer.java    License: Apache License 2.0 5 votes vote down vote up
public static void main(String[] args) throws Exception {
	PropertyConfigurator.configureAndWatch("config/log4j.properties", 5000L);
	log.info("\r\n\t      Migration-tool instance start, port:" + Config.getInt("port") + " [version 1.0-SNAPSHOT] \r\n\t\t\t Copyright (C) 2015 JJF");
	//insert db
	TableConstants.init();
	
	//定时判断id段是否超时
	ScheduledExecutorService scheduleExec = Executors.newScheduledThreadPool(1);
	scheduleExec.scheduleAtFixedRate(new SegementTimeoutTask(), 0, SegementManager.SEGEMENT_INTERVAL, TimeUnit.SECONDS);
	
	final NettyServer nettyServer = new NettyServer();
	
	Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() {
		
		@Override
		public void run() {
			try {
				nettyServer.stop();
				log.info("shutdown server");
			} catch (Exception e) {
				log.error("nettyServer stop error!", e);
			}
		}
	}));
	
	ThreadFactory tf = new NamedThreadFactory("BUSINESSTHREAEFACTORY");
	ExecutorService threadPool = new ThreadPoolExecutor(20, 100, 30, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(), tf);
	nettyServer.start(Config.getInt("port"), threadPool, Config.getLong("timeout"));
}
 
Example 21
Source Project: multi-model-server   Source File: Cts.java    License: Apache License 2.0 5 votes vote down vote up
private static void updateLog4jConfiguration() {
    System.setProperty("LOG_LOCATION", "logs");
    System.setProperty("METRICS_LOCATION", "logs");

    Properties props = new Properties();
    try (InputStream is = Cts.class.getResourceAsStream("log4j.properties")) {
        props.load(is);
    } catch (IOException e) {
        System.out.println("Cannot load log4j configuration file"); // NOPMD
    }

    PropertyConfigurator.configure(props);
}
 
Example 22
Source Project: oink   Source File: ConfigurationLoader.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void contextInitialized(ServletContextEvent se) {
	String logFileName = se.getServletContext().getInitParameter("log4jFileName");
	String env= System.getenv("env");
	
	String confFileName;
	if (env == null){
		confFileName = se.getServletContext().getInitParameter("configFileName");
	}else{
		confFileName= "/" + env + ".properties";
	}
	
	if(logFileName != null) {
		InputStream in = getClass().getResourceAsStream(logFileName);
		if(in == null) {
			in = ClassLoader.getSystemResourceAsStream(logFileName);
		}
		try {
			PropertyConfigurator.configure(in);
		} catch(Exception e) {
			e.printStackTrace();
		}
	}
	if (confFileName != null){
		PropertyLoader.getInstance().init(confFileName);
	}
}
 
Example 23
public static void main(String[] args) {
	// TODO Auto-generated method stub
	try {
		PropertyConfigurator.configure(System.getProperty("user.dir") + File.separator + "log4j.conf");
		String taskid = args[0];
		String batchcase = args[1];
		TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskid));
		TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskid));
		if (taskScheduling.getTaskType() == 0) {
				BatchTestCaseExecution.batchCaseExecuteForTast(
                           String.valueOf(task.getTaskId()), batchcase);
		} else if (taskScheduling.getTaskType() == 1) {
				// UI����
				WebBatchExecute.batchCaseExecuteForTast(
						String.valueOf(task.getTaskId()), batchcase);

		} else if (taskScheduling.getTaskType() == 2) {
			Properties properties = AppiumConfig.getConfiguration();

			if ("Android".equals(properties.getProperty("platformName"))) {
				AndroidBatchExecute.batchCaseExecuteForTast(
                           String.valueOf(task.getTaskId()), batchcase);
			} else if ("IOS".equals(properties.getProperty("platformName"))) {
				IosBatchExecute.batchCaseExecuteForTast(
                           String.valueOf(task.getTaskId()), batchcase);
			}

		}
	} catch (Exception e) {
		// TODO Auto-generated catch block
		LogUtil.APP.error("���������������������������쳣�����飡",e);
	} finally{
		System.exit(0);
	}
}
 
Example 24
Source Project: bigtable-sql   Source File: SquirrelLoggerFactory.java    License: Apache License 2.0 5 votes vote down vote up
private void initialize(FileAppender fa, boolean doStartupLogging)
	{
		String configFileName = ApplicationArguments.getInstance().getLoggingConfigFileName();
		if (configFileName != null)
		{
			PropertyConfigurator.configure(configFileName);
		}
		else
		{
         Properties props = new Properties();
         props.setProperty("log4j.rootLogger", "debug, SquirrelAppender");
         props.setProperty("log4j.appender.SquirrelAppender", "net.sourceforge.squirrel_sql.client.SquirrelFileSizeRollingAppender");
         props.setProperty("log4j.appender.SquirrelAppender.layout", "org.apache.log4j.PatternLayout");
         props.setProperty("log4j.appender.SquirrelAppender.layout.ConversionPattern", "%d{ISO8601} [%t] %-5p %c %x - %m%n");

         PropertyConfigurator.configure(props);


//			Logger.getRootLogger().removeAllAppenders();
//			BasicConfigurator.configure(fa);
//			final ILogger log = createLogger(getClass());
//			if (log.isInfoEnabled()) {
//				log.info("No logger configuration file passed on command line arguments. Using default log file: "
//					+ fa.getFile());
//			}
		}
		if (doStartupLogging)
		{
			doStartupLogging();
		}
	}
 
Example 25
public static void main(String[] args) {
	try{
		PropertyConfigurator.configure(System.getProperty("user.dir")+ File.separator +"log4j.conf");
		String taskId = args[0];
		String caseId = args[1];
		TaskExecute task = GetServerApi.cgetTaskbyid(Integer.parseInt(taskId));
		TaskScheduling taskScheduling = GetServerApi.cGetTaskSchedulingByTaskId(Integer.parseInt(taskId));
		if (taskScheduling.getTaskType() == 0) {
				// �ӿڲ���
			    TestCaseExecution testCaseExecution=new TestCaseExecution();
			    testCaseExecution.oneCaseExecuteForTask(Integer.valueOf(caseId), String.valueOf(task.getTaskId()));

		} else if (taskScheduling.getTaskType() == 1) {
				WebOneCaseExecute.oneCaseExecuteForTast(Integer.valueOf(caseId),
						String.valueOf(task.getTaskId()));

		} else if (taskScheduling.getTaskType() == 2) {
			Properties properties = AppiumConfig.getConfiguration();

			if ("Android".equals(properties.getProperty("platformName"))) {
				AndroidOneCaseExecute.oneCaseExecuteForTast(Integer.valueOf(caseId),
						String.valueOf(task.getTaskId()));
			} else if ("IOS".equals(properties.getProperty("platformName"))) {
				IosOneCaseExecute.oneCaseExecuteForTast(Integer.valueOf(caseId),
						String.valueOf(task.getTaskId()));
			}

		}
	}catch(Exception e){
		LogUtil.APP.error("���������������������������쳣�����飡",e);
	} finally{
		System.exit(0);
	}
}
 
Example 26
Source Project: MET-CS665   Source File: TestTaxpayerTypes.java    License: Apache License 2.0 5 votes vote down vote up
@Before
public void runBeforeTestMethod() {
  // NOTE: Setting the log4j property should not be here.
  // It should be passed better by the JVM arguments.
  // Like -Dlog4j.configuration={path to the log4j.properties config file}
  PropertyConfigurator.configure("log4j.properties");
}
 
Example 27
Source Project: Cardshifter   Source File: GameClient.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {	  
	PropertyConfigurator.configure(getClass().getResourceAsStream("log4j.properties"));
	Parent root = FXMLLoader.load(getClass().getResource("LauncherDocument.fxml"));
	
	Scene scene = new Scene(root);
	
	stage.setScene(scene);
	//stage.centerOnScreen();
	stage.show();
}
 
Example 28
/**
 * Main functioncount
 * @param args CommandLinesArgumentcount
 */
public static void main(String[] args) {
	PropertyConfigurator.configure("config/etc/log.cfg");
	log.debug("RuleEditor start");

	if(args.length > 0) {
		new RuleEditor(args[0]);
	} else {
		new RuleEditor();
	}
}
 
Example 29
Source Project: development   Source File: LoggerFactory.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Sets the log level for the given logger. If there is no property file to
 * be used, the log level will be set to the value as given in the level
 * parameter.
 * 
 * @param logger
 *            The logger to be modified.
 * @param level
 *            The log level to be set if no property file can be found.
 */
private static void setLogLevel(Log4jLogger logger, Level level) {
    if (logConfigPath != null && new File(logConfigPath).exists()) {
        PropertyConfigurator.configureAndWatch(logConfigPath, 60000);
    } else {
        logger.systemLogger.setLevel(level);
        logger.auditLogger.setLevel(level);

        // used INFO log level as default for the reverse proxy logger
        logger.proxyLogger.setLevel(Level.INFO);

        // all access operations will be logged with info level
        logger.accessLogger.setLevel(Level.INFO);
    }
}
 
Example 30
protected static void configureLogging() {
    String schedHome = System.getProperty(PASchedulerProperties.SCHEDULER_HOME.getKey());
    String defaultLog4jConfig = schedHome + "/config/log/server.properties";
    if (setPropIfNotAlreadySet(CentralPAPropertyRepository.LOG4J.getName(), defaultLog4jConfig))
        PropertyConfigurator.configure(defaultLog4jConfig);
    setPropIfNotAlreadySet("java.util.logging.config.file", defaultLog4jConfig);
    setPropIfNotAlreadySet("derby.stream.error.file", schedHome + "/logs/Database.log");
    RMStarter.overrideAppenders();
}