public static void main(String[] args) throws IOException {
PropertyConfigurator.configure("log4j.info");
BufferedReader reader = new BufferedReader(new FileReader(args[0]));
FileOutputStream out = new FileOutputStream(new File("/usr/local/RAID/geonames.nt"));
String buffer = null;
int count = 0;
while ((buffer = reader.readLine()) != null) {
if (++count % 2 == 0) {
logger.debug("processing xml: " + buffer);
Model model = ModelFactory.createDefaultModel() ;
model.read(new StringReader(buffer), null, "RDF/XML");
model.write(out, "N-TRIPLE");
} else {
logger.info("skipping: " + buffer);
}
}
reader.close();
}
java类org.apache.log4j.PropertyConfigurator的实例源码
Loader.java 文件源码
项目:linked_data_authorities
阅读 32
收藏 0
点赞 0
评论 0
MainServer.java 文件源码
项目:strictfp-back-end
阅读 22
收藏 0
点赞 0
评论 0
public static void main(@NotNull @NonNls String[] args) throws Exception {
PropertyConfigurator.configure(System.getProperty("user.dir") + "/log4j.properties");
logger.warn("StrictFP | Back-end");
logger.info("StrictFP Back-end is now running...");
Server server = new Server(Constant.SERVER.SERVER_PORT);
ServletContextHandler context =
new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/api/v0");
server.setHandler(context);
server.setStopAtShutdown(true);
// 像下面这行一样
context.addServlet(new ServletHolder(new GetQuiz()), "/misc/getquiz");
context.addServlet(new ServletHolder(new TimeLine()), "/timeline");
context.addServlet(new ServletHolder(new Counter()), "/misc/counter");
context.addServlet(new ServletHolder(new User()), "/user");
context.addServlet(new ServletHolder(new Heartbeat()), "/misc/heartbeat");
context.addServlet(new ServletHolder(new SafeCheck()), "/misc/safecheck");
context.addServlet(new ServletHolder(new CheckCert()), "/auth/check_cert");
//
server.start();
server.join();
}
App.java 文件源码
项目:fwm
阅读 27
收藏 0
点赞 0
评论 0
public static void main(String[] args) throws Exception {
// PRODUCTION mode needs to be determined before we get here...
AppConfig.firstInit();
prod = AppConfig.getProd();
appFileUtil = new AppFileUtil();
if(!appFileUtil.success()){
System.err.println(appFileUtil.getErrorMessage());
Platform.runLater(new Runnable(){
public void run(){
Alert al = new Alert(AlertType.ERROR);
al.setResizable(true);
for(Node n : al.getDialogPane().getChildren()){
if(n instanceof Label){
((Label)n).setMinHeight(Region.USE_PREF_SIZE);
}
}
al.setContentText(appFileUtil.getErrorMessage());
al.setHeaderText("FWM Startup Error");
al.showAndWait();
System.exit(-1);
}
});
return;
}
// ignore everything else because this means that we're in a jar file, so the app won't work
// if it doesn't think that we're prod.
PropertyConfigurator.configure(appFileUtil.getLog4JFile().getAbsolutePath());
AppConfig.init();
HotkeyController.init();
log.debug("Currently prod? " + prod);
log.debug(retGlobalResource("/src/main/webapp/WEB-INF/images/FWM-icon.png").getFile());
launch(args);
}
FileTailerSource.java 文件源码
项目:improved-journey
阅读 16
收藏 0
点赞 0
评论 0
public void configure(Context context) {
batchUpperLimit = context.getInteger("batchUpperLimit",1);
PropertyConfigurator.configure(PropertyUtil.getCurrentConfPath() + "log4j.properties");
log.info(PropertyUtil.getCurrentConfPath() + "log4j.properties");
prop.put("fileRootDir", context.getString("fileRootDir",""));
//批量提交Event个数
prop.put("batchUpperLimit", context.getString("batchUpperLimit","1"));
//获取快照文件存放根目录
prop.put("backupFileDirPath", context.getString("backupFileDirPath", ""));
// // 目录文件组合方式 0:文件log4j滚动、1:文件非log4j滚动
// // 2:日期目录+文件log4j滚动 3:日期目录+文件非log4j滚动
// prop.put("rollType", context.getString("rollType",""));
// 日期目录
// prop.put("dateDir", context.getString("dateDir",""));
// 文件前缀(实时文件名前缀)
prop.put("filePrefix", context.getString("filePrefix",""));
// 文件后缀
prop.put("fileSuffix", context.getString("fileSuffix",""));
// 文件字符集
prop.put("charset", context.getString("charset", "UTF-8"));
// 文件字符集
prop.put("bufferSize", context.getString("bufferSize", "4096"));
//设置正则表达式匹配的文件名
prop.put("regexFileName", context.getString("regexFileName", ".*"));
prop.put("clearTimeInterval", context.getString("clearTimeInterval", "3600000"));
}
DiameterServer.java 文件源码
项目:SigFW
阅读 14
收藏 0
点赞 0
评论 0
private static void configLog4j() {
InputStream inStreamLog4j = DiameterServer.class.getClassLoader().getResourceAsStream("log4j.properties");
Properties propertiesLog4j = new Properties();
try {
propertiesLog4j.load(inStreamLog4j);
PropertyConfigurator.configure(propertiesLog4j);
} catch (Exception e) {
e.printStackTrace();
}
log.debug("log4j configured");
}
DiameterFirewall.java 文件源码
项目:SigFW
阅读 15
收藏 0
点赞 0
评论 0
private static void configLog4j() {
InputStream inStreamLog4j = DiameterFirewall.class.getClassLoader().getResourceAsStream("log4j.properties");
Properties propertiesLog4j = new Properties();
try {
propertiesLog4j.load(inStreamLog4j);
PropertyConfigurator.configure(propertiesLog4j);
} catch (Exception e) {
e.printStackTrace();
}
logger.debug("log4j configured");
}
AbstractSctpBase.java 文件源码
项目:SigFW
阅读 21
收藏 0
点赞 0
评论 0
public void init() {
try {
Properties tckProperties = new Properties();
InputStream inStreamLog4j = AbstractSctpBase.class.getResourceAsStream("/log4j.properties");
System.out.println("Input Stream = " + inStreamLog4j);
Properties propertiesLog4j = new Properties();
try {
propertiesLog4j.load(inStreamLog4j);
PropertyConfigurator.configure(propertiesLog4j);
} catch (IOException e) {
e.printStackTrace();
BasicConfigurator.configure();
}
logger.debug("log4j configured");
String lf = System.getProperties().getProperty(LOG_FILE_NAME);
if (lf != null) {
logFileName = lf;
}
// If already created a print writer then just use it.
try {
logger.addAppender(new FileAppender(new SimpleLayout(), logFileName));
} catch (FileNotFoundException fnfe) {
}
} catch (Exception ex) {
ex.printStackTrace();
throw new RuntimeException(ex);
}
}
Test_DiameterFirewall.java 文件源码
项目:SigFW
阅读 13
收藏 0
点赞 0
评论 0
private static void configLog4j() {
InputStream inStreamLog4j = DiameterFirewall.class.getClassLoader().getResourceAsStream("log4j.properties");
Properties propertiesLog4j = new Properties();
try {
propertiesLog4j.load(inStreamLog4j);
PropertyConfigurator.configure(propertiesLog4j);
} catch (Exception e) {
e.printStackTrace();
}
logger.debug("log4j configured");
}
ZKServerTest.java 文件源码
项目:TakinRPC
阅读 14
收藏 0
点赞 0
评论 0
public static void main(String[] args) {
try {
PropertyConfigurator.configure("conf/log4j.properties");
ZkServer zk = new ZkServer("D:/zk/data", "D:/zk/log", 2181);
zk.start();
} catch (Exception e) {
e.printStackTrace();
}
}
ZKClientTest.java 文件源码
项目:TakinRPC
阅读 23
收藏 0
点赞 0
评论 0
public void init() {
try {
PropertyConfigurator.configure("conf/log4j.properties");
client = new ZkClient("localhost:2182");
// client.close();
} catch (Exception e) {
e.printStackTrace();
}
}