Joomla component writing two log entries - why?

For Joomla! 3.x Coding related discussions, you could also use: http://groups.google.com/group/joomla-dev-general

Moderators: ooffick, General Support Moderators

Forum rules
Locked
gba
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 117
Joined: Tue Jun 03, 2014 3:37 pm

Joomla component writing two log entries - why?

Post by gba » Wed Dec 21, 2022 3:35 pm

Hello!

When I add a line of code to a Joomla component, which writes an entry into a log file, this log entry is created twice.
I also added the server request time stamp to the log entry - it is different with each of the two log entries.
Why is Joomla running the same component two times?

Thank you very much for any useful hint!

Dear greetings,
Gerald
Last edited by toivo on Wed Dec 21, 2022 8:49 pm, edited 1 time in total.
Reason: mod note: moved from 3.x Performance, retitled

User avatar
toivo
Joomla! Master
Joomla! Master
Posts: 17423
Joined: Thu Feb 15, 2007 5:48 am
Location: Sydney, Australia

Re: Joomla component writing two log entries - why?

Post by toivo » Wed Dec 21, 2022 9:13 pm

Which component is this? Please copy and paste at least the line of code that was added.
Toivo Talikka, Global Moderator

gba
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 117
Joined: Tue Jun 03, 2014 3:37 pm

Re: Joomla component writing two log entries - why?

Post by gba » Thu Dec 22, 2022 9:44 am

Hi!

Thank you for responding.

It does not matter, which component.
i. e. I added following code to /components/com_content/content.php:19:

Code: Select all

JLog::addLogger(array('text_file' => 'component_debug.log.php','text_entry_format' => '{DATE} {TIME}'."\n".'{MESSAGE}'),JLog::ALL,array('component_debug'));
JLog::add(new Joomla\CMS\Log\LogEntry("Server request time: ".$_SERVER["REQUEST_TIME_FLOAT"], JLog::INFO, 'component_debug'));
Calling the website once the log contains:

Code: Select all

#
#<?php die('Forbidden.'); ?>
#Date: 2022-12-22 09:38:05 UTC
#Software: Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT

#Fields: date time
message
2022-12-22 09:38:05
Server request time: 1671701885.6041
2022-12-22 09:38:06
Server request time: 1671701886.8018
Kind regards,
Gerald


Locked

Return to “Joomla! 3.x Coding”