yozishni boshlashdan avval JNDI jurnali yozishni boshlash

JNDI 1500 satr atrofida diskda nosozliklarni yozishni boshlash paytida boshlanishda stdout-ga chiqish uchun bahor yuklash ilovasi mavjud. Buni nima sababdan biladigan har kim biladimi, va bundan oldin bu ishga kirishni boshlash uchun usul bormi? Menda -Dlogback.debug = haqiqiy, lekin u ko'p yordam bermaydi.

10:44:56.453 [main] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [java:comp/env/logging.exception-conversion-word]
10:44:56.457 [main] DEBUG jndi - InitialContextFactory.getInitialContext()
10:44:56.457 [main] DEBUG jndi - Created initial context delegate for local namespace:[email protected]
10:44:56.457 [main] DEBUG org.eclipse.jetty.jndi.java.javaURLContextFactory - >>> new root context requested 
10:44:56.457 [main] DEBUG jndi - Looking up name="comp/env/logging.exception-conversion-word"
10:44:56.457 [main] DEBUG jndi - Trying thread context classloader
10:44:56.457 [main] DEBUG jndi - Looking up name="env/logging.exception-conversion-word"
10:44:56.458 [main] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/logging.exception-conversion-word] not found - trying original name [logging.exception-conversion-word]. javax.naming.NameNotFoundException; remaining name 'env/logging.exception-conversion-word'
10:44:56.458 [main] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [logging.exception-conversion-word]

...

10:44:56.487 [main] DEBUG jndi - Looking up name="env/LOGGING_PATTERNLEVEL"
10:44:56.487 [main] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/LOGGING_PATTERNLEVEL] not found - trying original name [LOGGING_PATTERNLEVEL]. javax.naming.NameNotFoundException; remaining name 'env/LOGGING_PATTERNLEVEL'
10:44:56.487 [main] DEBUG org.springframework.jndi.JndiTemplate - Looking up JNDI object with name [LOGGING_PATTERNLEVEL]
10:44:56.487 [main] DEBUG jndi - InitialContextFactory.getInitialContext()
10:44:56.487 [main] DEBUG jndi - Created initial context delegate for local namespace:[email protected]
10:44:56.487 [main] DEBUG jndi - Looking up name="LOGGING_PATTERNLEVEL"
10:44:56.487 [main] DEBUG org.springframework.jndi.JndiPropertySource - JNDI lookup for name [LOGGING_PATTERNLEVEL] threw NamingException with message: null. Returning null.
10:44:56,536 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender]
10:44:56,539 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT]
10:44:56,543 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
10:44:56,561 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender]
10:44:56,564 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE]
10:44:56,565 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property
10:44:56,571 |-INFO in [email protected] - Will use the pattern /tmp/logs/qs.%d{yyyyMMdd-HHmmss}.log to archive files
10:44:56,574 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: /tmp/logs/qs.log
10:44:56,574 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [/tmp/logs/qs.log]
10:44:56,576 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to WARN
10:44:56,576 |-INFO in [email protected] - Propagating WARN level on Logger[ROOT] onto the JUL framework
10:44:56,576 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT]
10:44:56,576 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT]
10:44:56,576 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration.
10:44:56,577 |-INFO in org.s[email protected]32b260fa - Registering current configuration as safe fallback point

  .   ____          _            __ _ _
 /\\/___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, |////
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.4.4.RELEASE)

10:44:56,750 |-INFO in c.q.l.co.rolling.helper.RenameUtil - Renaming file [/tmp/logs/qs.log] to [/tmp/logs/qs.20170222-173130.log]
10:44:56 [main] INFO  my.Application - Starting ...
10
Qaysi muhitda arizangizni ishlatasiz? JNDI bilan faollashtirilgan Jettyga o'xshaydi. Katta Jetty dan foydalanasizmi yoki urush faylini tarqatasizmi?
qo'shib qo'ydi muallif Andy Wilkinson, manba
Qaysi muhitda arizangizni ishlatasiz? JNDI bilan faollashtirilgan Jettyga o'xshaydi. Katta Jetty dan foydalanasizmi yoki urush faylini tarqatasizmi?
qo'shib qo'ydi muallif Andy Wilkinson, manba
Bundan tashqari, mustaqil Tomcat 8.0.33 dan foydalanishda ham bo'ladi. Quyidagi "spring.jndi.ignore = true" javob ishlaydi, lekin yaxshi emas.
qo'shib qo'ydi muallif mle, manba
Bundan tashqari, mustaqil Tomcat 8.0.33 dan foydalanishda ham bo'ladi. Quyidagi "spring.jndi.ignore = true" javob ishlaydi, lekin yaxshi emas.
qo'shib qo'ydi muallif mle, manba
biz o'rnatilgan uchish vositasidan foydalanmoqdamiz. @SpringBootApplication (scanBasePackages = {}} kabi boshlaymiz (exclude = {...}) @ImportResource ("classpath: /spring/foobar-context.xml") @ServletComponentScan ommaviy sinfi FoobarApplication kengaytiradi SpringBootServletInitializer {public static void main (Oxirgi satr [] args) {SpringApplication.run (FoobarApplication.class, args); } ...}
qo'shib qo'ydi muallif dlipofsky, manba
biz o'rnatilgan uchish vositasidan foydalanmoqdamiz. @SpringBootApplication (scanBasePackages = {}} kabi boshlaymiz (exclude = {...}) @ImportResource ("classpath: /spring/foobar-context.xml") @ServletComponentScan ommaviy sinfi FoobarApplication kengaytiradi SpringBootServletInitializer {public static void main (Oxirgi satr [] args) {SpringApplication.run (FoobarApplication.class, args); } ...}
qo'shib qo'ydi muallif dlipofsky, manba

6 javoblar

Bundan tashqari, maxsus springback-spring.xml dasturidan foydalangan holda Spring Boot 1.5.1 versiyasini ham ko'rdim. Logback-spring.xml bo'lmasa, disk raskadrovka bayonnomalari ko'rinmaydi.

JNDIPropertySourceni o'chirib, uni atrofida ishlashga muvaffaq bo'ldim. Classpath root faylida spring.properties faylini yarating:

# Disable the JNDIPropertySource. This avoids dozens of spurious DEBUG messages
# when starting up with a custom logback-spring.xml. We're not alone:
# http://stackoverflow.com/questions/42446013/spring-jndi-logging-before-logback-is-initialized
spring.jndi.ignore=true

spring.jndi.ignore https://jira.spring.io/browse/SPR-14026 saytiga qo'shilgan. .

Ushbu yondashuv jiddiy his qiladi, lekin JNDI foydali bo'lgan konteynerda ishlamayotganim uchun men uchun hech narsa buzilmaydi.

11
qo'shib qo'ydi
Agar kimdir bu masalani hal qilsa. Ushbu o'zgarish spring.properties-da konfiguratsiya qo'yilganda men uchun ishlaydi, lekin uni bootstrap.properties-ga qo'yganimda emas.
qo'shib qo'ydi muallif mad_fox, manba
Bu men uchun ishlaydi. Siz shuningdek, -D belgisi bilan o'rnatishingiz mumkin, lekin fayl mening maqsadlar uchun yaxshiroq ishlaydi.
qo'shib qo'ydi muallif dlipofsky, manba

Bundan tashqari, maxsus springback-spring.xml dasturidan foydalangan holda Spring Boot 1.5.1 versiyasini ham ko'rdim. Logback-spring.xml bo'lmasa, disk raskadrovka bayonnomalari ko'rinmaydi.

JNDIPropertySourceni o'chirib, uni atrofida ishlashga muvaffaq bo'ldim. Classpath root faylida spring.properties faylini yarating:

# Disable the JNDIPropertySource. This avoids dozens of spurious DEBUG messages
# when starting up with a custom logback-spring.xml. We're not alone:
# http://stackoverflow.com/questions/42446013/spring-jndi-logging-before-logback-is-initialized
spring.jndi.ignore=true

spring.jndi.ignore https://jira.spring.io/browse/SPR-14026 saytiga qo'shilgan. .

Ushbu yondashuv jiddiy his qiladi, lekin JNDI foydali bo'lgan konteynerda ishlamayotganim uchun men uchun hech narsa buzilmaydi.

11
qo'shib qo'ydi
Agar kimdir bu masalani hal qilsa. Ushbu o'zgarish spring.properties-da konfiguratsiya qo'yilganda men uchun ishlaydi, lekin uni bootstrap.properties-ga qo'yganimda emas.
qo'shib qo'ydi muallif mad_fox, manba
Bu men uchun ishlaydi. Siz shuningdek, -D belgisi bilan o'rnatishingiz mumkin, lekin fayl mening maqsadlar uchun yaxshiroq ishlaydi.
qo'shib qo'ydi muallif dlipofsky, manba

Men ham xuddi shu muammoga duch kelgan edim, lekin jndi-ni o'chirib qo'ya olmadim, chunki mening dasturim ishga tushirildi. Shunday qilib, ba'zi tadqiqotlarimdan keyin men hal qildim:

1) rename logback-spring.xml to some other name, for example logback-config.xml

2) logging.config xususiyatini application.properties faylga qo'ying.

Natijada sizga konfiguratsiy faqat bahorda ishga tushiriladi va bu disk raskadrovka jurnali o'tkazib yuboriladi. Bundan tashqari, menda birinchi yechim ishlamadi, chunki jndi kerak edi, bu holda siz jndi ni yoqishingiz mumkin.

Update: this helped only for local environment, to make the same work on remote tomcat and remove this debug log from catalina.log file, I ended up with renaming this logback file to logback.xml, thus it's found on the startup, before jndi lookup.

2
qo'shib qo'ydi

Men ham xuddi shu muammoga duch kelgan edim, lekin jndi-ni o'chirib qo'ya olmadim, chunki mening dasturim ishga tushirildi. Shunday qilib, ba'zi tadqiqotlarimdan keyin men hal qildim:

1) rename logback-spring.xml to some other name, for example logback-config.xml

2) logging.config xususiyatini application.properties faylga qo'ying.

Natijada sizga konfiguratsiy faqat bahorda ishga tushiriladi va bu disk raskadrovka jurnali o'tkazib yuboriladi. Bundan tashqari, menda birinchi yechim ishlamadi, chunki jndi kerak edi, bu holda siz jndi ni yoqishingiz mumkin.

Update: this helped only for local environment, to make the same work on remote tomcat and remove this debug log from catalina.log file, I ended up with renaming this logback file to logback.xml, thus it's found on the startup, before jndi lookup.

2
qo'shib qo'ydi

bu satrni logback xml fayliga qo'shish orqali oldini olishingiz mumkin


2
qo'shib qo'ydi
Yo'q, qilolmaysiz, chunki bu xabarlar qayta tiklashdan oldin jurnalga yoziladi. Mening hisob-kitoblarim allaqachon sukut bo'yicha WARN-ga o'rnatildi.
qo'shib qo'ydi muallif dlipofsky, manba

bu satrni logback xml fayliga qo'shish orqali oldini olishingiz mumkin


2
qo'shib qo'ydi
Yo'q, qilolmaysiz, chunki bu xabarlar qayta tiklashdan oldin jurnalga yoziladi. Mening hisob-kitoblarim allaqachon sukut bo'yicha WARN-ga o'rnatildi.
qo'shib qo'ydi muallif dlipofsky, manba