我做了一些搜索,寻找有关如何使用Spring Framework进行日志记录的信息.
我们目前有一个除了system.out语句之外没有登录的应用程序(非常糟糕的方式).
我想做的是添加日志记录,但也希望能够在运行时控制日志记录,比如说JMX.
我们正在使用Rad 7.0/WebSphere 6.1
我很有兴趣找出实现这个目标的最佳方法(我想可能有几个).
更新:关于以下Spring AOP Logging的想法不错的理想与否.这是关于此处发布的有关日志记录的问题: 条件日志记录.这是改善了事情还是仅仅在伐木方面变得更加困难?
我遇到了一个问题,IE没有像Firefox那样打开Excel文档的"另存为/打开"对话框.
所以我创建了一个servlet过滤器,它使用'*.xls'作为url模式.我现在面临的问题(因为这是我创建的第一个过滤器)是如何获取用户想要的文件的名称,以便正确填充对话框.目前,当用户选择给定页面上的链接时,将调用过滤器.
这是我想出的:
以上是我的doFilter().
String fileName = "fileName.xls";
HttpServletRequest httpRequest = (HttpServletRequest) pRequest;
String requestURI = httpRequest.getRequestURI();
if(StringUtils.isNotBlank(requestURI))
{
String uri[] = StringUtils.split(requestURI, '/');
fileName = uri[uri.length - 1];
}
HttpServletResponse httpResponse = (HttpServletResponse) pResponse;
httpResponse.setContentType("application/vnd.ms-excel");
httpResponse.setHeader("Content-disposition", "attachment; filename=\"" + fileName +"\"");
Run Code Online (Sandbox Code Playgroud)
web.xml中:
<filter>
<filter-name>ExcelFilter</filter-name>
<filter-class>vsg.rp.common.ExcelFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ExcelFilter</filter-name>
<url-pattern>*.xls</url-pattern>
</filter-mapping>
Run Code Online (Sandbox Code Playgroud)
这一切都在我的开发盒上运行:Windows XP,JBoss,Eclipse,Oracle.但是当它在测试服务器上运行时 - Linux,Apache/JBoss,Oracle - 它不起作用.似乎甚至没有调用过滤器,没有抛出错误等等.任何想法为什么会发生这种情况?
有人建议,为了提高我们系统的性能,应该全面使用延迟加载.这是将带有"mappedBy"属性的OneToOne映射更改为@OneToMany映射.这是为了解决和停止从数据库加载不需要的数据,这导致应用程序的缓慢.
我们运行一个多层系统(基本上是2层).我们有前端 - 使用JSF和后端,它包含业务和数据库访问层.前端和后端通信视图EJB - 但EJB中没有真正的逻辑.使用的其他技术 - Spring和Hibernate
现在,经过对该主题的一些阅读后,似乎lazing loading的使用并不是一个银弹,因为它需要正确应用.对于每个延迟加载,将发出Select语句以获取数据.还有一个问题是,如果前端访问要延迟加载的属性并且会话/连接在后端关闭,那么我们将获得null.
以上是正确的关注吗?
那么,实施延迟加载解决方案或性能改进的最佳方法/实践是什么?如果可能的话,希望不是重做数据模型.
我最初的工作是与DBA小组合作,以了解两个系统之间的情况 - 查询的外观,我们如何使用数据等.识别故障点,检查Hibernate对象/查询以了解如何最好改进它.还要查看前端以确定数据从后向前传递到何处以及如何显示等.
好方法/其他方法?
我正在审查在我们的应用程序中使用Ivy的过程.我已经设置了一个简单的配置来拉下cobertura.
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info
organisation="com"
module="adesa"
status="integration">
</info>
<configurations>
<conf name="runtime" description=""/>
</configurations>
<dependencies>
<dependency org="cobertura" name="cobertura" rev="1.8" transitive="true"/>
</dependencies>
</ivy-module>
Run Code Online (Sandbox Code Playgroud)
我知道cobertura依赖于其他jar文件.那么如何获得其他jar文件?我在缓存目录中看到的唯一一件事是cobertura jar文件.
这是我的ivysetting.xml
<ivysettings>
<settings defaultResolver="chained" />
<resolvers>
<chain name="chained" returnFirst="true">
<url name="apache" m2compatible="true">
<!--Apache -->
<artifact pattern="http://repo1.maven.org/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
<artifact pattern="http://people.apache.org/repo/m2-incubating-repository/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<url name="jboss" m2compatible="true">
<!-- JBoss -->
<artifact pattern="http://repository.jboss.com/maven2/[organisation]/[module]/[revision]/[artifact]-[revision].[ext]" />
</url>
<ibiblio name="ibiblio" m2compatible="true" />
<url name="mvnrepos" m2compatible="true">
<!-- IBIBLIO-Mirror -->
<artifact pattern="http://mirrors.ibiblio.org/pub/mirrors/maven2/[organisation]/[module]/[branch]/[revision]/[branch]-[revision].[ext]" />
</url>
</chain>
</resolvers>
Run Code Online (Sandbox Code Playgroud)
是否有可用于获取依赖项/ jar的其他存储库列表?
build.xml文件中的代码段:
<target name="load-ivy">
<path id="ivy.lib.path">
<fileset …Run Code Online (Sandbox Code Playgroud)