लॉग आउटपुट के लिए मैं स्प्रिंग लॉग को कैसे अक्षम कर सकता हूं जिसे मैं आसानी से पढ़ सकता हूं या कोई और पढ़ सकता है। how to disable spring bean loading log पर एक समान प्रश्न का उत्तर substring
log4j.properties
file
में सभी पंक्तियों पर टिप्पणी करने का सुझाव दिया गया है। मेरे मामले में ऐसी कोई लाइन नहीं है।पठनीय लॉग को अक्षम करने के लिए स्प्रिंग लॉग को अक्षम करना
log4j.logger.com.foo=WARN
अब आप ही देख सकते हैं कंसोल में चेतावनी, त्रुटि और घातक लॉग्स:
यहाँ log4j.properties
# Define the root logger with appender file
log4j.rootLogger = DEBUG, stdout
# Define the file appender
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
# Set the name of the logs destination
log4j.appender.stdout.target=System.out
# Set the immediate flush to true (default)
log4j.appender.stdout.ImmediateFlush=true
# Set the threshold to debug mode
log4j.appender.stdout.Threshold=debug
# Set the append to false, overwrite
log4j.appender.stdout.Append=false
# Define the layout for appender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.conversionPattern=%d{yyyy-MM-dd}:%m%n
यह सही है। लेकिन ओपी की जरूरतों के आधार पर यह वास्तव में डिफ़ॉल्ट स्तर को INFO या उच्चतर पर सेट करने के लिए और अधिक उपयोगी हो सकता है और उदाहरण के लिए, अपने स्वयं के पैकेज के लिए डीबग का उपयोग करना। –