我在log4j 2中有一个关于RollingFile Appender的Filepattern的问题。RollingFile需要FileName和FilePattern,但是我不知道FilePattern的作用。我认为它只是被忽略了。这是我的log4j2.xml的一部分
<Property name="pattern">
%-5p [%d{dd.MM.yyyy - HH:mm:ss}] : %m%n %ex
</Property>
<Property name="MainLoggerPath">
C:/logs/MainLogger.log
</Property>
<Property name="FilePattern">
C:/logs/$${date:yyyy-MM}/app-%d{MM- dd-yyyy}-%i.log.gz
</Property>
<RollingFile name="MainAppender" fileName="${MainLoggerPath}"
filePattern="${FilePattern}">
<ThresholdFilter level="ALL" onMatch="ACCEPT" onMismatch="DENY" />
<PatternLayout
pattern="${pattern}" />
<Policies>
<SizeBasedTriggeringPolicy size="10 MB" />
</Policies>
<DefaultRolloverStrategy max="10" />
</RollingFile>
Run Code Online (Sandbox Code Playgroud) 你好,我有一个这样的字符串:6-006.a9&&20130323^000~1-206&&20130329^000~1-208.2&&20130322^000
我希望得到日期.我有一个有效的解决方案,但我认为它很长:
String replace = pw.replace('&', '^');
String[] rrex = replace.split("\\^+");
for(String s:rrex)
{
if(s.matches("[0-9]{8}"))
{
System.out.println(s);
}
}
Run Code Online (Sandbox Code Playgroud)
这段代码不是我想要的,我可以用正则表达式获取日期吗?喜欢String[] dates = pw.split(regex);
我有一个来自tabel innerHTML的字符串,在这里我需要使用正则replace表达式删除所有img标签,第一个img标签后将一切都删除,我在JSFiddle的代码在这里
我得到RuntimeException
枚举类型可能无法实例化
我不知道为什么.我想要的是用一个整数值来标识一年,就像我有9所以其他方法的年份是2006年.代码:
public class P21Make {
enum Catalog {
year2005(9),year2006(12),year2007(15),year2008(18),
year2009(21),year2010(23),year2011(25),year2012(28),
year2013(31),year2014(33),year2015(36),year2016(39),
year2017(42),year2018(45),year2019(48),year2020(51);
private int id;
Catalog(int c){
this.id=c;
}
}
public P21Make() {
Catalog c = new Catalog(9); // The Exception
}
}
Run Code Online (Sandbox Code Playgroud) 单击按钮时设置JLabel时我遇到了这个问题,就像加载图标一样.p.make()执行该方法,但在Method返回Label可见后,Label仍然不可见.有人可以解释发生了什么吗?
的actionPerformed:
String[] args = {jTextFieldDrgzusatzVariable.getText(),jTextFieldAusgabe.getText(),"C:\\CPOracle",jTextFieldKatalog.getText()};
this.jLblLoading.setVisible(true);
if(jLblLoading.isVisible()){
try{
new P21Make(args[0],args[1],args[2],args[3]).make();
}catch(Exception e){
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)