2012-02-27 27 views
5

Tôi đang cố gắng để đăng nhập vào một tập tin sử dụng doc - http://tomcat.apache.org/tomcat-7.0-doc/logging.htmlTomcat không đăng nhập để nộp

Dưới đây là logging.properties tôi tại TOMCAT_HOME/conf

# Licensed to the Apache Software Foundation (ASF) under one or more 
# contributor license agreements. See the NOTICE file distributed with 
# this work for additional information regarding copyright ownership. 
# The ASF licenses this file to You under the Apache License, Version 2.0 
# (the "License"); you may not use this file except in compliance with 
# the License. You may obtain a copy of the License at 
# 
#  http://www.apache.org/licenses/LICENSE-2.0 
# 
# Unless required by applicable law or agreed to in writing, software 
# distributed under the License is distributed on an "AS IS" BASIS, 
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
# See the License for the specific language governing permissions and 
# limitations under the License. 

handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3manager.org.apache.juli.FileHandler, 4host-manager.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler 

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler 

############################################################ 
# Handler specific properties. 
# Describes specific configuration info for Handlers. 
############################################################ 

1catalina.org.apache.juli.FileHandler.level = FINE 
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 
1catalina.org.apache.juli.FileHandler.prefix = catalina. 

2localhost.org.apache.juli.FileHandler.level = FINE 
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 
2localhost.org.apache.juli.FileHandler.prefix = localhost. 

3manager.org.apache.juli.FileHandler.level = FINE 
3manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 
3manager.org.apache.juli.FileHandler.prefix = manager. 

4host-manager.org.apache.juli.FileHandler.level = FINE 
4host-manager.org.apache.juli.FileHandler.directory = ${catalina.base}/logs 
4host-manager.org.apache.juli.FileHandler.prefix = host-manager. 

java.util.logging.ConsoleHandler.level = FINE 
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter 


############################################################ 
# Facility specific properties. 
# Provides extra control for each logger. 
############################################################ 

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = DEBUG 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler 

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].level = DEBUG 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/manager].handlers = 3manager.org.apache.juli.FileHandler 

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].level = DEBUG 
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/host-manager].handlers = 4host-manager.org.apache.juli.FileHandler 

# For example, set the org.apache.catalina.util.LifecycleBase logger to log 
# each component that extends LifecycleBase changing state: 
#org.apache.catalina.util.LifecycleBase.level = FINE 

# To see debug messages in TldLocationsCache, uncomment the following line: 
#org.apache.jasper.compiler.TldLocationsCache.level = FINE 

Đây là logging.properties tại/src/main/webapp/WEB-INF/các lớp học

handlers = org.apache.juli.FileHandler, java.util.logging.ConsoleHandler 

############################################################ 
# Handler specific properties. 
# Describes specific configuration info for Handlers. 
############################################################ 

org.apache.juli.FileHandler.level = FINE 
org.apache.juli.FileHandler.directory = ${catalina.base}/logs 
org.apache.juli.FileHandler.prefix = mywebapp 

java.util.logging.ConsoleHandler.level = FINE 
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter 

Nhưng tệp nhật ký không được tạo, tôi có thiếu gì đó không?

Trả lời

4

Đối với tôi vấn đề này là do: catalina.base không được đặt chính xác và vì vậy tomcat đã cố ghi vào thư mục không tồn tại.

Cập nhật: thư mục không tồn tại được đặt bởi catalina.base

+2

Làm thế nào để bạn đến để biết về vấn đề này? Làm thế nào tôi có thể kiểm tra xem tôi cũng phải đối mặt với vấn đề này cho cùng một lý do? – RAS

+0

@ blue-sky vui lòng thêm thông tin do RAS – Dwhitz

+1

@Dwhitz i cập nhật câu trả lời, không chắc chắn cách tôi có thể làm cho câu trả lời này rõ ràng hơn. –

2

Chạy cùng một vấn đề. Trong trường hợp của tôi, vấn đề là do thiếu quyền truy cập ghi vào thư mục nhật ký cho người dùng mà dịch vụ tomcat đang chạy.

+1

Cách kiểm tra người dùng mà dịch vụ tomcat đang chạy và liệu người dùng đó có quyền truy cập hay không? – RAS

-4

Cố gắng khởi tạo thư mục như thủ công như E:/_ logs/tomcat7 nơi bạn muốn đặt file log của bạn thay vì $ {} catalina.base/nhật ký

Các vấn đề liên quan