为Log4j配置Eclipse [英] Configure Eclipse for Log4j

查看:100
本文介绍了为Log4j配置Eclipse的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用apache jena开发一个应用程序,以使用sparql访问dbpedia.好吧,我对DBPedia和apache jena还是陌生的,我做了一些研究,并从一些示例代码开始创建VCARD.

I am working on an application using apache jena, to access dbpedia using sparql. Well I am very new to DBPedia and apache jena, I did some research and started with some sample code to create VCARD.

公共类DpPedia扩展了对象{

public class DpPedia extends Object {

static String personURI   = "<!..http://def/JohnSmith..!>";
static String fullName    = "John Smith";
static String Fullname = "Pulkit Gupta";

  public static void main (String args[]) {
    // create an empty model
    Model model = ModelFactory.createDefaultModel();

   // create the resource
   Resource johnSmith = model.createResource(personURI);
   Resource pulkitgupta=model.createResource(personABC);

  // add the property
  johnSmith.addProperty(VCARD.FN, fullName);
  pulkitgupta.addProperty(VCARD.FN,Fullname);

  }

}

但是,当我尝试执行此代码时..它最终会显示错误

However when i tried to execute this code .. It end up with an error

log4j:WARN找不到记录器的附加程序(org.apache.jena.riot.stream.JenaIOEnvironment). log4j:WARN请正确初始化log4j系统. log4j:WARN请参见 http://logging.apache.org/log4j/1.2/faq .html#noconfig 了解更多信息.

log4j:WARN No appenders could be found for logger (org.apache.jena.riot.stream.JenaIOEnvironment). log4j:WARN Please initialize the log4j system properly. log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

看来我的Eclipse配置不正确,我需要安装Log4j.好吧,我下载了文件,但是不确定如何使用eclipse对其进行配置.

it seems my eclipse is not configured properly and I need to install Log4j. Well I downloaded the files, but not sure how up configure it with eclipse.

推荐答案

jena使用log4j作为日志记录系统,并且警告消息明确表明您缺少log4j.properties对其进行初始化.

jena use log4j as logging system, and the warning messages tell explicitly that you are lacking of a log4j.properties to initialize it.

当找不到默认配置文件log4j.properties和log4j.xml并且应用程序不执行任何显式配置时,会发生这种情况."

"This occurs when the default configuration files log4j.properties and log4j.xml can not be found and the application performs no explicit configuration."

在src下创建log4j.properties文件,然后重试.您可以在此处

Create log4j.properties file under src and retry. You can find some sample config files here

这篇关于为Log4j配置Eclipse的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆