首页 \ 问答 \ Log4j不使用log4j.properties创建任何文件(Log4j doesn't create any file using log4j.properties)

Log4j不使用log4j.properties创建任何文件(Log4j doesn't create any file using log4j.properties)

我使用log4j.properties创建日志文件时遇到问题。 文件未生成。 无论我尝试什么。 这是Tomcat的日志:

INFO: Initializing log4j from [/usr/share/tomcat7/webapps/Money/WEB-INF/classes /log4j.properties]
lis 03, 2013 10:37:29 PM org.apache.catalina.core.ApplicationContext log

web.xml中

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/classes/log4j.properties</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

    <context-param>
        <param-name>log4jRefreshInterval</param-name>
        <param-value>10000</param-value>
    </context-param>

log4j.properties

# Root logger option
log4j.debug=true
log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=logs/money.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

这是我如何使用我的记录器:

private static final Logger LOGGER = LoggerFactory.getLogger(HomeController.class);

并且即:

LOGGER.debug("Finding user by email FAILED");

I have a problem with creating a log file using log4j.properties. File is not generated. No matter what I try. Here's log from Tomcat:

INFO: Initializing log4j from [/usr/share/tomcat7/webapps/Money/WEB-INF/classes /log4j.properties]
lis 03, 2013 10:37:29 PM org.apache.catalina.core.ApplicationContext log

web.xml

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>/WEB-INF/classes/log4j.properties</param-value>
    </context-param>

    <listener>
        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
    </listener>

    <context-param>
        <param-name>log4jRefreshInterval</param-name>
        <param-value>10000</param-value>
    </context-param>

log4j.properties

# Root logger option
log4j.debug=true
log4j.rootLogger=DEBUG, file, stdout
# Direct log messages to a log file
log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=logs/money.log
log4j.appender.file.MaxFileSize=1MB
log4j.appender.file.MaxBackupIndex=1
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
# Direct log messages to stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

and here's how I use my logger:

private static final Logger LOGGER = LoggerFactory.getLogger(HomeController.class);

and i.e. :

LOGGER.debug("Finding user by email FAILED");

原文:https://stackoverflow.com/questions/19758539
更新时间:2022-11-13 15:11

最满意答案

只需过滤具有所需距离的瓷砖(并排除点击的瓷砖),就像这样

 $('#grid .tile').filter(function(){
            return Math.abs($(this).data('row') - row) <= movableTiles && Math.abs($(this).data('tile') - tile) <= movableTiles && !($(this).data('row') == row && $(this).data('tile') == tile)
 }).addClass('moveable');

http://jsfiddle.net/z6vbzjz0/2/

EDIT根据您的距离定义(Manhatten-Distance)进行过滤应该像这样:

 $('#grid .tile').filter(function(){
            return ( Math.abs($(this).data('row') - row) +  Math.abs($(this).data('tile') - tile) )<= movableTiles && !($(this).data('row') == row && $(this).data('tile') == tile)
        }).addClass('moveable');

http://jsfiddle.net/z6vbzjz0/4/


Just filter the tiles which have desired distance (and exclude clicked tile) like this

 $('#grid .tile').filter(function(){
            return Math.abs($(this).data('row') - row) <= movableTiles && Math.abs($(this).data('tile') - tile) <= movableTiles && !($(this).data('row') == row && $(this).data('tile') == tile)
 }).addClass('moveable');

http://jsfiddle.net/z6vbzjz0/2/

EDIT Filtering according to your distance-definition (Manhatten-Distance) should be done like this:

 $('#grid .tile').filter(function(){
            return ( Math.abs($(this).data('row') - row) +  Math.abs($(this).data('tile') - tile) )<= movableTiles && !($(this).data('row') == row && $(this).data('tile') == tile)
        }).addClass('moveable');

http://jsfiddle.net/z6vbzjz0/4/

相关问答

更多
  • 对不起,我误解了这个问题,但我想我现在已经知道了: // Scale the distance from the original point to the center of the canvas var xDistance:Number = ((_tile.x + cameraPoint.x) - xCenter) * matrixScale; var yDistance:Number = ((_tile.y + cameraPoint.y) - yCenter) * matrixScale; // ...
  • Rectangle有一个方法Contains(Point) ,你可以用它来轻松检测一个点是否在矩形内。 假设您的Node类具有BoundingRectangle属性。 class Node { // ... public Rectangle BoundingRectangle { get { return new Rectangle(x, y, width, height); } } // ... } 现在处理鼠标点击: MouseState mou ...
  • 测试一个特定的按钮是否被按下(或触摸过屏幕),如果是,在一个区域中设置正确的目标区块(玩家将要去的区块)并开始在那里移动,这个移动只会在玩家处于下一个瓷砖。 发生这种情况时,再次检查输入以保持移动(即重复)。 让我们假设,你的瓷砖宽度/高度是1,并且你想每秒移动1个瓷砖。 您的用户按下右箭头键。 然后你只需将敌手设置在玩家正前方的瓦片上。 if(targettile!=null){ yourobject.position.x += 1*delta; if(yourobject.positio ...
  • 只需过滤具有所需距离的瓷砖(并排除点击的瓷砖),就像这样 $('#grid .tile').filter(function(){ return Math.abs($(this).data('row') - row) <= movableTiles && Math.abs($(this).data('tile') - tile) <= movableTiles && !($(this).data('row') == row && $(this).data('tile') == til ...
  • 尝试这个: 1 2 你需要阅读这个文档: https : //material.angular.io/components/grid-list/overview Try this:
    我建议调查模数运算符而不是嵌套循环。 这篇博客文章概述了如何做到这一点: http://www.davidpett.com/actionscript-3-dynamic-rows-and-columns/ 使用David的示例作为起点,您的代码将如下所示: var COLUMNS:int = int(Math.sqrt(tiles.length)); var PADDING:Number = 10; for(var i:int; i < tiles.length; i++) { var tile: ...
  • 我将给出4方向16个版本的答案(更容易可视化,写出更短),但这个想法延伸到8方向的情况。 如果我正确阅读,你想弄清楚如何布置你的精灵,这样你就可以根据你,你,d,r找出你需要的位置。 这里你基本上有一个4位数 - 其中每个位对应一个方向的连通性。 所以你可以生成你的精灵: ULDR 0000: No connections 0001: Right side connected 0010: Down connected 0011: Down and right connected 0100: Left co ...
  • 单击此处查看方案文件 我建议结合我的方案使用以下结构: 瓷砖通常保存瓷砖的数量,每个瓷砖具有一个id,瓷砖的尺寸是硬编码的:例如5 * 5像素。 tiles_meta保存名称和简短的“工具提示”描述。 META是自我解释的;) tiles_content_low包含少量的tile。 在这里,您应该包括用户将多次访问的内容,但要保持最小化。 tiles_content_medium包含诸如“这里项目xy可以找到12%的可能性”之类的东西。 使用项目创建添加“loot_table”。 “item_hash”是可 ...
  • 即使我重新编写动画逻辑以使动画距离尽可能长,但它仍然非常生涩,只有几个对象。 似乎用透明度动画多个UIImageViews并不是一个好主意。 我现在正在使用Sprite Kit,一切都很流畅,运行速度为60fps。 这不是一个很大的变化,因为Sprite Kit非常类似。 Even when I rewrote the animation logic so that the animation distance would be as long as possible it was still very j ...
  • 但是我不能在检查玩家和敌人之间的碰撞时使用这种方法,因为我只使用二维数组(2和3)内的值来选择最初绘制敌人和玩家方块的位置。 也许这暴露了你的设计中的缺陷,你应该修复而不是解决。 我没有足够的代码来完全说明,但似乎是在复制Player类或其他网格中的信息。 根据您的描述,每个正方形包含值为0-1-2-3的2D网格完整地描述了游戏的状态。 为什么不直接使用Grid作为一切事物的唯一来源呢? However I can't use this method when checking collision betw ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)