我们在Mule 3.6.4服务器上部署了各种mule应用程序,并且在应用程序的类路径中定义了自己的log4j配置,如下所示。 (1的例子)
<?xml version="1.0" encoding="utf-8"?>
<Configuration>
<Appenders>
<Console name="console" target="SYSTEM_OUT">
<PatternLayout
pattern="<%-4d{DATE}> <%-5p> <%t> <%m> %n" />
</Console>
<RollingFile name="file"
fileName="${sys:mule.home}/logs/apptest.log"
filePattern="${sys:mule.home}/logs/apptest.%d{yyyy-MM-dd}">
<PatternLayout
pattern="<%-4d{DATE}> <%-5p> <%t> <%m> %n" />
<TimeBasedTriggeringPolicy />
</RollingFile>
</Appenders>
<Loggers>
<AsyncRoot level="INFO">
<AppenderRef ref="console" />
<AppenderRef ref="file" />
</AsyncRoot>
</Loggers>
</Configuration>
这些应用程序已在Mule ESB中的此订单中部署
应用1 应用2 Appplication3
由于某种原因,应用程序的所有日志记录都输出到控制台,而只输出应用程序3的日志文件。日志记录不适用于应用程序1或2?
任何人都能对此有所了解吗?这是一些类加载器问题吗?我们正在运行Mule 3.6.4
由于
答案 0 :(得分:1)
因为 class stats
{
private $n;
private $i;
private $or;
private $cplus;
private $cminus;
public function __construct($n, $i, $or, $cplus, $cminus)
{
$this->n = $n;
$this->i = $i;
$this->or = $or;
$this->cplus = $cplus;
$this->cminus = $cminus;
}
function getN()
{
return $this->n;
}
function getI()
{
return $this->i;
}
function getOr()
{
return $this->or;
}
function getCplus()
{
return $this->cplus;
}
function getCminus()
{
return $this->cminus;
}
}
class team
{
private $position;
private $name;
private $score;
private $ag;
private $dk;
private $together;
private $within;
private $out;
private $penalties;
public function __construct(DOMNodeList $nodes)
{
if ($nodes->length == 22) {
$this->position = (int) $nodes->item(0)->textContent;
$this->name = $nodes->item(2)->textContent;
$this->score = (int) $nodes->item(3)->textContent;
$this->ag = (int) $nodes->item(4)->textContent;
$this->dk = (int) $nodes->item(5)->textContent;
$this->together = new stats((int)$nodes->item(6)->textContent,
(int)$nodes->item(7)->textContent,
(int)$nodes->item(8)->textContent,
(int)$nodes->item(9)->textContent,
(int)$nodes->item(10)->textContent);
$this->within = new stats( (int)$nodes->item(11)->textContent,
(int)$nodes->item(12)->textContent,
(int)$nodes->item(13)->textContent,
(int)$nodes->item(14)->textContent,
(int)$nodes->item(15)->textContent);
$this->out = new stats( (int)$nodes->item(16)->textContent,
(int)$nodes->item(17)->textContent,
(int)$nodes->item(18)->textContent,
(int)$nodes->item(19)->textContent,
(int)$nodes->item(20)->textContent);
$this->penalties = (int) $nodes->item(21)->textContent;
} else {
throw new Exception("Incorrect input data");
}
}
public function getPosition()
{
return $this->position;
}
public function getName()
{
return $this->name;
}
public function getScore()
{
return $this->score;
}
public function getAg()
{
return $this->ag;
}
public function getDk()
{
return $this->dk;
}
public function getTogether()
{
return $this->together;
}
public function getWithin()
{
return $this->within;
}
public function getOut()
{
return $this->out;
}
public function getPenalties()
{
return $this->penalties;
}
}
配置中有<AppenderRef ref="console" />
,所以一切都会进入控制台。你的log4j配置应该在每个{app} / classes /中。
对于File appender,您是否尝试为每个应用程序使用不同的文件名 -
<Logger>
第二个应用程序 -
<RollingFile name="file"
fileName="${sys:mule.home}/logs/app1test.log"
filePattern="${sys:mule.home}/logs/app1test.%d{yyyy-MM-dd}">
答案 1 :(得分:0)
您是否尝试过对RollingFile appenders使用append参数?您还可以考虑为每个应用程序的RollingFile名称提供唯一值。像这样:
对于Application1 -
<RollingFile name="app2_file"
fileName="${sys:mule.home}/logs/app1test.log"
filePattern="${sys:mule.home}/logs/app1test.%d{yyyy-MM-dd}" append="true">
<PatternLayout
pattern="<%-4d{DATE}> <%-5p> <%t> <%m> %n" />
<TimeBasedTriggeringPolicy />
</RollingFile>
对于Application2 -
<RollingFile name="file"
fileName="${sys:mule.home}/logs/appt2est.log"
filePattern="${sys:mule.home}/logs/app2test.%d{yyyy-MM-dd}" append="true">
<PatternLayout
pattern="<%-4d{DATE}> <%-5p> <%t> <%m> %n" />
<TimeBasedTriggeringPolicy />
</RollingFile>