You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Shaib Al-Agily <sh...@navyfederal.org.INVALID> on 2022/03/22 20:12:48 UTC

RE: [External] Re: org.apache.logging.log4j.jmx.HierarchyDynamicMBean not found in log4j 2

Thank you Ralph and Gary for your prompt response.

Perhaps I was not clear, the HierarchyDynamicMBean exists in the log4j-1.214.jar and our app uses it and there are no errors.
As we are trying to migrate to log4j-core-2.17.1, we noticed that HierarchyDynamicMBean is not part of log4j-core-2.17.1.jar and it is throwing errors.

My question are, 
is HierarchyDynamicMBean included in log4j 2? 
Is there an alternative solution/class? 
Can the HierarchyDynamicMBean class be packaged part of log4j2? 
Can the HierarchyDynamicMBean be extracted from log4j-1 and add it log4j-2?
Any suggestions on how to migrate log4j2?

Thank you

Shaib

-----Original Message-----
From: Ralph Goers <ra...@dslextreme.com> 
Sent: Monday, March 21, 2022 6:48 PM
To: Log4J Users List <lo...@logging.apache.org>
Subject: [External] Re: org.apache.logging.log4j.jmx.HierarchyDynamicMBean not found in log4j 2

I’m confused. Log4j 1.x used the package org.apache.log4j. Log4j 2.x uses org.apache.logging.log4j. So how was that class part of Log4j 1.x?

Indeed - https://secure-web.cisco.com/1aJ9StItuostdVVrk_AythzsM_-usieWrcWBvKR5Qo3pDj-R-rqduf1Y2dmHEnQf7kTAgDnS7ieZqSYFjy1d9JuT-msPOSykVoeBj4ENeM7b1Np8LTq4WujNs7qJ4Py-OZipVC4xVhgEOq1F1Yx4F_XNOHbBqw8fMHk4L6qidmMp2XYmiM6H9QAkHWYxOO8qcFhVD1zfR7iNjIkY9ypNtfAMEmXmZAj-Xo4nE3Kr-zmXVaVyV_kcUU4Xrbe2eU3rr12RxqNu7sSsy9321TvgucXV4sevmlK6Tr_W4Ur4G8BDQWhQyUbNElOJ63Pw449k83uc65i9ZzA4-X6ZRDpk2dRTLFlha1aoPXA-g3Js5eXWfCLfQglFITMzJVQWwvdusIvq5A6VK4BYVlc2zsbr5fuB7o23Gli4izJk9dlmS1FtfeN7OIYtkx8-osLuNwrT92Fy9IZI84qSAoIuKDvYIfg/https%3A%2F%2Flogging.apache.org%2Flog4j%2F1.2%2Fapidocs%2Forg%2Fapache%2Flog4j%2Fjmx%2FHierarchyDynamicMBean.html
indicates the package name you show below is wrong.

Although Gary just added the JMX components to log4j-1.2-api I don’t believe you should actually use them. 
Log4j 2 comes with its own JMX support and since the design of Log4j 2 is different than Log4j 1 I suspect not everything in 1.x will work as expected.

Ralph

> On Mar 21, 2022, at 4:34 PM, Gary Gregory <ga...@gmail.com> wrote:
> 
> Shaib,
> 
> That whole package was never ported into the log4j-1.2-api module.
> 
> I just added the missing package for API binary compatibility.
> 
> Do note the package Javadoc: "This package lets you manage log4j 
> settings using JMX. It is unfortunately not of production quality."
> 
> There is no testing for behavioral compatibility, this is currently 
> only to avoid class not found errors. It is unlikely to work as expected.
> 
> You can find this code in the 'release-2.x' branch and snapshot builds 
> on 
> https://secure-web.cisco.com/18xOszRxVXXg0W1jCjpnCfB8pC5Rw4x-luLF26Hrg
> OY2ky_t5a3FqIGLmgeGdQ6ttTnECbjZ3Nk-699lYMF40iEi4rEGeMMAAvj8smCJ64OUOyh
> AJ2hAr93ffe461mOOwkF5JtMmkPLqBsQIZ6_o1yMzw_a3BN4Hokco1HsJcqDxKv7LavsEB
> 7pTMF-khL2mlTZENnuVFjldZguehKFiAs4NlE3KxHXnrWTPxqxYynOgVf35UxinOwLVgVw
> JC8UXInw42EpIe0rnrC3m7Au8C3YPIKn5DzhMwfDA4jqWQiLHUlFlm_gink-LLToBy9aI9
> GOoi67SDMlsYuS9BQzbttA1cjWsp-2_Bs0WKLFBu4Dppe5I_rqTEbkF6M7uGuWIJ2zicdT
> hd7t6zTOxpvfJtzvk5AD8ahB8fH-zzEHX3KGAzbZ7nB6yJwi_P3NaA1gbCZnus1DUOe6z1
> 4KJa5gG4qQ/https%3A%2F%2Frepository.apache.org%2Fcontent%2Frepositorie
> s%2Fsnapshots%2F
> 
> Gary
> 
> On Mon, Mar 21, 2022 at 5:13 PM Shaib Al-Agily 
> <sh...@navyfederal.org.invalid> wrote:
> 
>> Hello,
>> 
>> Per Apache's website recommendations, our company is in the process 
>> of migrating some of its applications from log4j-1.2.14 to log4j-core-2.17.1.
>> 
>> Class "org.apache.logging.log4j.jmx.HierarchyDynamicMBean" is 
>> referenced in one of our application and that is generating an error. 
>> It appears class org.apache.logging.log4j.jmx.HierarchyDynamicMBean 
>> is not implemented in log4j 2.
>> 
>> Questions:
>> 1.           Is the class
>> org.apache.logging.log4j.jmx.HierarchyDynamicMBean implemented in log4j 2?
>> Where?
>> 2.           Is it merged in another class?
>> 3.           Is there an alternative class/solution?
>> 
>> Thank you very much
>> 
>> Shaib
>> 
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org



Re: [External] org.apache.logging.log4j.jmx.HierarchyDynamicMBean not found in log4j 2

Posted by Ralph Goers <ra...@dslextreme.com>.
The reason Log4j 2 does not contain that Mean is because Log4j 2 has no Hierarchy object. Instead, it has a LoggerContext. It does have a LoggerContextAdminMBean and it has a LoggerConfigAdminMBean. The latter lets you inspect and manipulate logger configurations.

There would be no way to create the HierarchyDynamicMBean as it is defined in Log4j 1.2 as it references things that don’t exist in Log4j 2.

As for suggestions - Migrating code is largely a matter of changing the dependency and the imports and creating a suitable Log4j 2 configuration. The Log4j 2 API supports most of the Log4j 1 “api” (I use that term loosely since there was no well defined API).

The hard part comes with whatever customizations you have made or code that is accessing the internals of Log4j 1.x. Without knowing what you have done in that regard it is difficult to say what you need to do to migrate.

Ralph


> On Mar 22, 2022, at 1:12 PM, Shaib Al-Agily <sh...@navyfederal.org.INVALID> wrote:
> 
> Thank you Ralph and Gary for your prompt response.
> 
> Perhaps I was not clear, the HierarchyDynamicMBean exists in the log4j-1.214.jar and our app uses it and there are no errors.
> As we are trying to migrate to log4j-core-2.17.1, we noticed that HierarchyDynamicMBean is not part of log4j-core-2.17.1.jar and it is throwing errors.
> 
> My question are, 
> is HierarchyDynamicMBean included in log4j 2? 
> Is there an alternative solution/class? 
> Can the HierarchyDynamicMBean class be packaged part of log4j2? 
> Can the HierarchyDynamicMBean be extracted from log4j-1 and add it log4j-2?
> Any suggestions on how to migrate log4j2?
> 
> Thank you
> 
> Shaib
> 
> -----Original Message-----
> From: Ralph Goers <ralph.goers@dslextreme.com <ma...@dslextreme.com>> 
> Sent: Monday, March 21, 2022 6:48 PM
> To: Log4J Users List <log4j-user@logging.apache.org <ma...@logging.apache.org>>
> Subject: [External] Re: org.apache.logging.log4j.jmx.HierarchyDynamicMBean not found in log4j 2
> 
> I’m confused. Log4j 1.x used the package org.apache.log4j. Log4j 2.x uses org.apache.logging.log4j. So how was that class part of Log4j 1.x?
> 
> Indeed - https://secure-web.cisco.com/1aJ9StItuostdVVrk_AythzsM_-usieWrcWBvKR5Qo3pDj-R-rqduf1Y2dmHEnQf7kTAgDnS7ieZqSYFjy1d9JuT-msPOSykVoeBj4ENeM7b1Np8LTq4WujNs7qJ4Py-OZipVC4xVhgEOq1F1Yx4F_XNOHbBqw8fMHk4L6qidmMp2XYmiM6H9QAkHWYxOO8qcFhVD1zfR7iNjIkY9ypNtfAMEmXmZAj-Xo4nE3Kr-zmXVaVyV_kcUU4Xrbe2eU3rr12RxqNu7sSsy9321TvgucXV4sevmlK6Tr_W4Ur4G8BDQWhQyUbNElOJ63Pw449k83uc65i9ZzA4-X6ZRDpk2dRTLFlha1aoPXA-g3Js5eXWfCLfQglFITMzJVQWwvdusIvq5A6VK4BYVlc2zsbr5fuB7o23Gli4izJk9dlmS1FtfeN7OIYtkx8-osLuNwrT92Fy9IZI84qSAoIuKDvYIfg/https%3A%2F%2Flogging.apache.org%2Flog4j%2F1.2%2Fapidocs%2Forg%2Fapache%2Flog4j%2Fjmx%2FHierarchyDynamicMBean.html <https://secure-web.cisco.com/1aJ9StItuostdVVrk_AythzsM_-usieWrcWBvKR5Qo3pDj-R-rqduf1Y2dmHEnQf7kTAgDnS7ieZqSYFjy1d9JuT-msPOSykVoeBj4ENeM7b1Np8LTq4WujNs7qJ4Py-OZipVC4xVhgEOq1F1Yx4F_XNOHbBqw8fMHk4L6qidmMp2XYmiM6H9QAkHWYxOO8qcFhVD1zfR7iNjIkY9ypNtfAMEmXmZAj-Xo4nE3Kr-zmXVaVyV_kcUU4Xrbe2eU3rr12RxqNu7sSsy9321TvgucXV4sevmlK6Tr_W4Ur4G8BDQWhQyUbNElOJ63Pw449k83uc65i9ZzA4-X6ZRDpk2dRTLFlha1aoPXA-g3Js5eXWfCLfQglFITMzJVQWwvdusIvq5A6VK4BYVlc2zsbr5fuB7o23Gli4izJk9dlmS1FtfeN7OIYtkx8-osLuNwrT92Fy9IZI84qSAoIuKDvYIfg/https%3A%2F%2Flogging.apache.org%2Flog4j%2F1.2%2Fapidocs%2Forg%2Fapache%2Flog4j%2Fjmx%2FHierarchyDynamicMBean.html>
> indicates the package name you show below is wrong.
> 
> Although Gary just added the JMX components to log4j-1.2-api I don’t believe you should actually use them. 
> Log4j 2 comes with its own JMX support and since the design of Log4j 2 is different than Log4j 1 I suspect not everything in 1.x will work as expected.
> 
> Ralph
> 
>> On Mar 21, 2022, at 4:34 PM, Gary Gregory <garydgregory@gmail.com <ma...@gmail.com>> wrote:
>> 
>> Shaib,
>> 
>> That whole package was never ported into the log4j-1.2-api module.
>> 
>> I just added the missing package for API binary compatibility.
>> 
>> Do note the package Javadoc: "This package lets you manage log4j 
>> settings using JMX. It is unfortunately not of production quality."
>> 
>> There is no testing for behavioral compatibility, this is currently 
>> only to avoid class not found errors. It is unlikely to work as expected.
>> 
>> You can find this code in the 'release-2.x' branch and snapshot builds 
>> on 
>> https://secure-web.cisco.com/18xOszRxVXXg0W1jCjpnCfB8pC5Rw4x-luLF26Hrg <https://secure-web.cisco.com/18xOszRxVXXg0W1jCjpnCfB8pC5Rw4x-luLF26Hrg>
>> OY2ky_t5a3FqIGLmgeGdQ6ttTnECbjZ3Nk-699lYMF40iEi4rEGeMMAAvj8smCJ64OUOyh
>> AJ2hAr93ffe461mOOwkF5JtMmkPLqBsQIZ6_o1yMzw_a3BN4Hokco1HsJcqDxKv7LavsEB
>> 7pTMF-khL2mlTZENnuVFjldZguehKFiAs4NlE3KxHXnrWTPxqxYynOgVf35UxinOwLVgVw
>> JC8UXInw42EpIe0rnrC3m7Au8C3YPIKn5DzhMwfDA4jqWQiLHUlFlm_gink-LLToBy9aI9
>> GOoi67SDMlsYuS9BQzbttA1cjWsp-2_Bs0WKLFBu4Dppe5I_rqTEbkF6M7uGuWIJ2zicdT
>> hd7t6zTOxpvfJtzvk5AD8ahB8fH-zzEHX3KGAzbZ7nB6yJwi_P3NaA1gbCZnus1DUOe6z1
>> 4KJa5gG4qQ/https%3A%2F%2Frepository.apache.org <http://2frepository.apache.org/>%2Fcontent%2Frepositorie
>> s%2Fsnapshots%2F
>> 
>> Gary
>> 
>> On Mon, Mar 21, 2022 at 5:13 PM Shaib Al-Agily 
>> <sh...@navyfederal.org.invalid> wrote:
>> 
>>> Hello,
>>> 
>>> Per Apache's website recommendations, our company is in the process 
>>> of migrating some of its applications from log4j-1.2.14 to log4j-core-2.17.1.
>>> 
>>> Class "org.apache.logging.log4j.jmx.HierarchyDynamicMBean" is 
>>> referenced in one of our application and that is generating an error. 
>>> It appears class org.apache.logging.log4j.jmx.HierarchyDynamicMBean 
>>> is not implemented in log4j 2.
>>> 
>>> Questions:
>>> 1.           Is the class
>>> org.apache.logging.log4j.jmx.HierarchyDynamicMBean implemented in log4j 2?
>>> Where?
>>> 2.           Is it merged in another class?
>>> 3.           Is there an alternative class/solution?
>>> 
>>> Thank you very much
>>> 
>>> Shaib
>>> 
>>> 
>>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org <ma...@logging.apache.org>
> For additional commands, e-mail: log4j-user-help@logging.apache.org <ma...@logging.apache.org>