0

I want to update logback.xml in java programmatically, I tried to update sing DOM API but got an exception

Exception in thread "main" org.w3c.dom.DOMException: NO_MODIFICATION_ALLOWED_ERR: An attempt is made to modify an object where modifications are not allowed.
at com.sun.org.apache.xerces.internal.dom.ParentNode.internalInsertBefore(ParentNode.java:351)
at com.sun.org.apache.xerces.internal.dom.ParentNode.insertBefore(ParentNode.java:288)
at com.sun.org.apache.xerces.internal.dom.NodeImpl.appendChild(NodeImpl.java:238)
at XMLUtils.add(XMLUtils.java:49)

Java Result: 1

Can anyone tell me how to solve this issue, and is that any possibility to achieve this via logback API.

djechlin
  • 59,258
  • 35
  • 162
  • 290
  • 1
    It might not be, that's kind of the idea of a config. You might want to post more of your actual *problem* instead of the thing you're trying to do to solve it. – djechlin Feb 21 '16 at 19:01
  • I have something dynamics logger to add, but in running state its append the logger but i also want to update that xml file too – Yougeshwar Khatri Feb 21 '16 at 19:02
  • 1
    Update what XML file? logback.xml? That doesn't answer my question, you're just telling me you want to update logback again when I asked what problem you're trying to solve that requires updating logback. – djechlin Feb 21 '16 at 19:03
  • 1
    http://xyproblem.info/ – djechlin Feb 21 '16 at 19:04
  • related: http://stackoverflow.com/questions/5448673/slf4j-logback-how-to-configure-loggers-in-runtime?rq=1 –  Feb 21 '16 at 19:05
  • please check my answer again what i said, I said i have something business logic to add dynamic logger, so i also want to add those logger in xml file to for future restart app – Yougeshwar Khatri Feb 21 '16 at 19:28
  • I made the solution, thanks everyone :) – Yougeshwar Khatri Feb 23 '16 at 05:14

0 Answers0