我正在使用Apace Camel + Spring。我正在尝试使用log4j将我的日志从Camel Context打印到文件中。我在Camel Context中使用Log组件
func (c *Context) SetCookie(
name string,
value string,
maxAge int,
path string,
domain string,
secure bool,
httpOnly bool,
) {
if path == "" {
path = "/"
}
http.SetCookie(c.Writer, &http.Cookie{
Name: name,
Value: url.QueryEscape(value),
MaxAge: maxAge,
Path: path,
Domain: domain,
Secure: secure,
HttpOnly: httpOnly,
})
}
func (c *Context) Cookie(name string) (string, error) {
cookie, err := c.Request.Cookie(name)
if err != nil {
return "", err
}
val, _ := url.QueryUnescape(cookie.Value)
return val, nil
}
我也添加了log4j.properties。 但是日志将打印在Weblogic控制台上,而不是log4j.properties中指定的文件。
log4j.properties文件
<log loggingLevel="ERROR" message="Testing Logs with log4j" />