在可执行jar中使用时,log4j2不起作用

问题描述

我决定使用log4j2代替Java util日志记录,但是到目前为止,它似乎并不想在已编译的jar中工作。在Eclipse中,一切都很好,但是当我构建项目并运行它时,log4j2根本找不到任何插件

我以编程方式配置log4j,这是打印出来的xml配置。

function init() {
    document.addEventListener("deviceready",startup);
    startup();
}

var db;
var updateurl = "http://localhost:8888/serverbackend/service.cfc?method=getupdates&returnformat=json";

function dbError(e) {
    console.log("sql ERROR");
    console.dir(e);
}

function startup() {
    console.log("Starting up...");
    db = window.openDatabase("main","1","Main DB",1000000);
    db.transaction(initDB,dbError,dbReady);
}

function initDB(tx) {
    //tx.executesql("drop table docs");
    tx.executesql("create table if not exists docs(id INTEGER PRIMARY KEY AUTOINCREMENT,title TEXT,body TEXT,lastupdated DATE,token TEXT)");
}

function dbReady() {
    console.log("DB initialization done.");
    //begin sync process
    if(navigator.network && navigator.network.connection.type != Connection.NONE) syncDB();
    else syncDB();
}

function syncDB() {
    /**
    * Process is: What is my latest doc? if any
    * Ask server for changes since then
    */
    db.transaction(function(tx) {
        tx.executesql("select max(lastupdated) as lastdate from docs",[],function(tx,res) {
            console.log("Will get items after "+res.rows.item(0).lastdate);
            var date = res.rows.item(0).lastdate?res.rows.item(0).lastdate:'';
            $.get(updateurl,{date:date},function(resp,code) {
                console.log("back from getting updates with "+resp.length + " items to process.");
                //Ok,loop through. For each one,we see if it exists,and if so,we update/delete it
                //If it doesn't exist,straight insert
                resp.forEach(function(ob) {
                    console.dir(ob);
                    db.transaction(function(ctx) {
                        ctx.executesql("select id from docs where token = ?",[ob.token],checkres) {
                            if(checkres.rows.length) {
                                console.log("possible update/delete");
                                if(!ob.deleted) {
                                    console.log("updating "+ob.title+ " "+ob.lastupdated);
                                    tx.executesql("update docs set title=?,body=?,lastupdated=? where token=?",[ob.title,ob.body,ob.lastupdated,ob.token]);
                                } else {
                                    console.log("deleting "+ob.title+ " "+ob.lastupdated);
                                    tx.executesql("delete from docs where token = ?",[ob.token]);
                                }
                            } else {
                                //only insert if not deleted
                                console.log("possible insert");
                                if(!ob.deleted) {
                                    console.log("inserting "+ob.title+ " "+ob.lastupdated);
                                    tx.executesql("insert into docs(title,body,lastupdated,token) values(?,?,?)",ob.token]);
                                }
                            }

                        });
                    });
                });
            if(resp.length) localStorage["lastdate"] = resp[resp.length-1].lastupdated;
            displayDocs();    
            },"json");
        });

    },function() {
        console.log("I'm done with the transaction");
    });
}

function displayDocs() {
    db.transaction(function(tx) {
        tx.executesql("select title from docs order by title asc",results) {
            var s = "<h2>Docs</h2>";
            for(var i=0; i<results.rows.length; i++) {
                s += results.rows.item(i).title + "<br/>";
            }
            $("#docs").html(s);
        });
    });
}

我得到的错误

    @Html.PagedListPager(
    (IPagedList)Model.MyPagedListObject,page => Url.Action("MyControllerAction","MyController",new
    {
        page,size = Model.MyPagedListObject.PageSize
    }),PagedListRenderOptions.EnableunobtrusiveAjaxReplacing(
    new PagedListRenderOptions
    {
        MaximumPageNumbersTodisplay = 5,UlElementClasses = new[] { "pagination" },ContainerDivClasses = new[] { "pagination-container" },LiElementClasses = new string[] { "page-item" },PageClasses = new string[] { "page-link" }
    },new AjaxOptions()
    {
        InsertionMode = InsertionMode.Replace,HttpMethod = "GET",UpdateTargetId = "MyDivWrapperID"
    }))

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...