[JIRA] Created: (LBCLASSIC-292) Support optional include files

Support optional include files ------------------------------ Key: LBCLASSIC-292 URL: http://jira.qos.ch/browse/LBCLASSIC-292 Project: logback-classic Issue Type: Improvement Components: joran Affects Versions: 0.9.26 Reporter: Joachim Durchholz Assignee: Logback dev list Priority: Minor Logback emits a warning if a file named in <include/> isn't present. Sometimes, an included configuration file is purely optional. E.g. I would want to mail a more verbose configuration to a customer who has some mysterious error where the standard logging simply isn't detailed enough. Unfortunately, this means that in the standard case, I'll be spammed with the missing file warning, plus heaps of INFO messages. This might distract from relevant logback configuration problems. Suggestion: extend <include/> so that it accepts <include optional="true" ... />. If an include is optional, it will not generate error messages if the requested configuration is not present. The loading code might want to differentiate between "does not exist" (to suppress the message) and other problems (which probably should still be reported). -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira

[ http://jira.qos.ch/browse/LBCLASSIC-292?page=com.atlassian.jira.plugin.syste... ] Joern Huxhorn commented on LBCLASSIC-292: ----------------------------------------- Good idea. We have a rather similar use-case, too.
Support optional include files ------------------------------
Key: LBCLASSIC-292 URL: http://jira.qos.ch/browse/LBCLASSIC-292 Project: logback-classic Issue Type: Improvement Components: joran Affects Versions: 0.9.26 Reporter: Joachim Durchholz Assignee: Logback dev list Priority: Minor
Logback emits a warning if a file named in <include/> isn't present. Sometimes, an included configuration file is purely optional. E.g. I would want to mail a more verbose configuration to a customer who has some mysterious error where the standard logging simply isn't detailed enough. Unfortunately, this means that in the standard case, I'll be spammed with the missing file warning, plus heaps of INFO messages. This might distract from relevant logback configuration problems. Suggestion: extend <include/> so that it accepts <include optional="true" ... />. If an include is optional, it will not generate error messages if the requested configuration is not present. The loading code might want to differentiate between "does not exist" (to suppress the message) and other problems (which probably should still be reported).
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira

[ http://jira.qos.ch/browse/LBCLASSIC-292?page=com.atlassian.jira.plugin.syste... ] Ceki Gulcu commented on LBCLASSIC-292: -------------------------------------- Have you tried using conditionals? Here is an example (requires Janino library) <configuration> <!-- the FileExistsPropertyDefiner is not *currently* part of logback --> <define name="INCLUDED_FILE_EXISTS" class=" ch.qos.logback.core.property.FileExistsPropertyDefiner"> <path>/path/to/included/file<pathy> </define> <if condition="property("INCLUDED_FILE_EXISTS").equals("true")"> <then> <include file="/path/to/included/file"> </then> </if> <configuration> Here is a tentative implementation for FileExistsPropertyDefiner: package ch.qos.logback.core.property import ch.qos.logback.core.PropertyDefinerBase; import java.io.File; public class FileExistsPropertyDefiner extends PropertyDefinerBase { String path; public String getPath() { return path; } public void setPath(String path) { this.path = path; } public String getPropertyValue() { if(path == null) return "false"; File file = new File(path); if(file.exists()) return "true"; else return "false"; } }
Support optional include files ------------------------------
Key: LBCLASSIC-292 URL: http://jira.qos.ch/browse/LBCLASSIC-292 Project: logback-classic Issue Type: Improvement Components: joran Affects Versions: 0.9.26 Reporter: Joachim Durchholz Assignee: Logback dev list Priority: Minor
Logback emits a warning if a file named in <include/> isn't present. Sometimes, an included configuration file is purely optional. E.g. I would want to mail a more verbose configuration to a customer who has some mysterious error where the standard logging simply isn't detailed enough. Unfortunately, this means that in the standard case, I'll be spammed with the missing file warning, plus heaps of INFO messages. This might distract from relevant logback configuration problems. Suggestion: extend <include/> so that it accepts <include optional="true" ... />. If an include is optional, it will not generate error messages if the requested configuration is not present. The loading code might want to differentiate between "does not exist" (to suppress the message) and other problems (which probably should still be reported).
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira

[ http://jira.qos.ch/browse/LBCLASSIC-292?page=com.atlassian.jira.plugin.syste... ] Ceki Gulcu resolved LBCLASSIC-292. ---------------------------------- Resolution: Fixed With the addition of FileExistsPropertyDefiner the desired behavior can be achieved with conditional inclusion as described above.
Support optional include files ------------------------------
Key: LBCLASSIC-292 URL: http://jira.qos.ch/browse/LBCLASSIC-292 Project: logback-classic Issue Type: Improvement Components: joran Affects Versions: 0.9.26 Reporter: Joachim Durchholz Assignee: Logback dev list Priority: Minor
Logback emits a warning if a file named in <include/> isn't present. Sometimes, an included configuration file is purely optional. E.g. I would want to mail a more verbose configuration to a customer who has some mysterious error where the standard logging simply isn't detailed enough. Unfortunately, this means that in the standard case, I'll be spammed with the missing file warning, plus heaps of INFO messages. This might distract from relevant logback configuration problems. Suggestion: extend <include/> so that it accepts <include optional="true" ... />. If an include is optional, it will not generate error messages if the requested configuration is not present. The loading code might want to differentiate between "does not exist" (to suppress the message) and other problems (which probably should still be reported).
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira

[ http://jira.qos.ch/browse/LBCLASSIC-292?page=com.atlassian.jira.plugin.syste... ] Joachim Durchholz commented on LBCLASSIC-292: --------------------------------------------- My understanding is that Janino allows injecting arbitrary code into the application. This would be a huge problem for me, since the configuration file is supposed to be user-editable. I'll add a separate improvement proposal describing a design alternative to Janino.
Support optional include files ------------------------------
Key: LBCLASSIC-292 URL: http://jira.qos.ch/browse/LBCLASSIC-292 Project: logback-classic Issue Type: Improvement Components: joran Affects Versions: 0.9.26 Reporter: Joachim Durchholz Assignee: Logback dev list Priority: Minor
Logback emits a warning if a file named in <include/> isn't present. Sometimes, an included configuration file is purely optional. E.g. I would want to mail a more verbose configuration to a customer who has some mysterious error where the standard logging simply isn't detailed enough. Unfortunately, this means that in the standard case, I'll be spammed with the missing file warning, plus heaps of INFO messages. This might distract from relevant logback configuration problems. Suggestion: extend <include/> so that it accepts <include optional="true" ... />. If an include is optional, it will not generate error messages if the requested configuration is not present. The loading code might want to differentiate between "does not exist" (to suppress the message) and other problems (which probably should still be reported).
-- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira
participants (3)
-
Ceki Gulcu (JIRA)
-
Joachim Durchholz (JIRA)
-
Joern Huxhorn (JIRA)