Feature PR-5.0-dev Pending

User tests: Successful: Unsuccessful:

avatar svenbluege
svenbluege
17 Mar 2023

Make the registerLogger-method static, so somebody can use it to register custom loggers using custom namespaces. Currently, one needs to use the Joomla-namespace, which is not ideal.

The other methods in this class are already static, I assume this is just something which was forgotten.

Summary of Changes

Make the registerLogger-method static, so somebody can use it to register custom loggers.

Testing Instructions

None. This method is unused in Joomla so far.

Actual result BEFORE applying this Pull Request

I can't add custom loggers

Expected result AFTER applying this Pull Request

I can add custom loggers with a non-Joomla namespace

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar joomla-cms-bot joomla-cms-bot - change - 17 Mar 2023
Category Libraries
avatar svenbluege svenbluege - open - 17 Mar 2023
avatar svenbluege svenbluege - change - 17 Mar 2023
Status New Pending
avatar svenbluege svenbluege - change - 17 Mar 2023
Title
Make this method static so somebody can use it to register custom log…
Log class // Make this method static so somebody can use it to register custom log…
avatar svenbluege svenbluege - edited - 17 Mar 2023
avatar carlitorweb
carlitorweb - comment - 17 Mar 2023

In fact this function you mention should be deprecated in favor of Joomla\CMS\Log\LoggerRegistry::register

avatar svenbluege
svenbluege - comment - 18 Mar 2023

@carlitorweb Thank you for the hint. Joomla\CMS\Log\Log::registerLogger uses Joomla\CMS\Log\LoggerRegistry::register and keeps a LoggerRegistry as singleton. I could not find a place where the LoggerRegistry was used differently. I'm sure I missed that spot. Can you point me to an example, please?

avatar joomdonation joomdonation - test_item - 20 Mar 2023 - Tested successfully
avatar joomdonation
joomdonation - comment - 20 Mar 2023

I have tested this item successfully on dd7ed78

Makes sense.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40145.

avatar viocassel viocassel - test_item - 29 Mar 2023 - Tested successfully
avatar viocassel
viocassel - comment - 29 Mar 2023

I have tested this item successfully on dd7ed78


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40145.

avatar richard67 richard67 - change - 30 Mar 2023
Status Pending Ready to Commit
Labels Added: PR-4.3-dev
avatar richard67
richard67 - comment - 30 Mar 2023

RTC


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40145.

avatar laoneo laoneo - change - 31 Mar 2023
Status Ready to Commit Needs Review
avatar laoneo
laoneo - comment - 31 Mar 2023

Putting this on needs review as it is a BC break. Please introduce a new function and then deprecate this one for 6.0.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/40145.

avatar svenbluege
svenbluege - comment - 31 Mar 2023

I understand that making a method static is an API change. In this case, it is nearly impossible to call that method directly. The method is not used across the Joomla source code, and for extensions it is impossible to call it since one needs an instance of Log, which has a protected constructor.

@laoneo Anyway, I'm fine with a new method if this is required. I just need some ideas on the naming. I guess registerLogger2 is not a good name ;) Any idea for a better one? It finally needs to step into the place of registerLogger

avatar laoneo
laoneo - comment - 31 Mar 2023

But you can extend the Log class and then call that function, or?

avatar svenbluege
svenbluege - comment - 31 Mar 2023

How do you know my code? ;) You're right.

But joking aside, what would be a good name? registerLogger_static? Are you aware of any good example in the Joomla-world?

avatar joomdonation
joomdonation - comment - 31 Mar 2023

@svenbluege How about registerCustomLogger ? I think it could be a good name.

avatar HLeithner
HLeithner - comment - 8 May 2023

This pull request has been automatically rebased to 5.0-dev. No new features will be merged into Joomla! 4.3 series. Joomla! 4.4 series is a bridge release to make migration from Joomla! 4 to 5 as smooth as possible.

avatar svenbluege svenbluege - change - 9 May 2023
Labels Added: Feature PR-5.0-dev
Removed: PR-4.3-dev
avatar HLeithner
HLeithner - comment - 30 Sep 2023

This pull request has been automatically rebased to 5.1-dev.

avatar HLeithner
HLeithner - comment - 24 Apr 2024

This pull request has been automatically rebased to 5.2-dev.

avatar HLeithner HLeithner - change - 24 Apr 2024
Title
Log class // Make this method static so somebody can use it to register custom log…
[5.2] Log class // Make this method static so somebody can use it to register custom log…
avatar HLeithner HLeithner - edited - 24 Apr 2024
avatar HLeithner
HLeithner - comment - 2 Sep 2024

This pull request has been automatically rebased to 5.3-dev.

avatar HLeithner HLeithner - change - 2 Sep 2024
Title
[5.2] Log class // Make this method static so somebody can use it to register custom log…
[5.3] Log class // Make this method static so somebody can use it to register custom log…
avatar HLeithner HLeithner - edited - 2 Sep 2024

Add a Comment

Login with GitHub to post a comment