Closed Bug 787280 Opened 12 years ago Closed 11 years ago

log4moz is not available on Fennec from its central location

Categories

(Remote Protocol :: Marionette, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: automatedtester, Assigned: automatedtester)

References

Details

Attachments

(1 file, 1 obsolete file)

We are either going to have to remove log4moz or have a build step to copy it in to the components and then load it that way.
that would require getting http://mxr.mozilla.org/mozilla-central/source/services/common/log4moz.js installed as part of services-common.  I am not sure if this is intended to be working in Fennec or not.  

I would assume asking the mobile or services teams would get the answer fastest.  If all else fails it wouldn't be too hard to write a mock version of this and put some exception handling around where we are importing it.
@wesj in #mobile suggested that I just put log4moz in the directory and just use that. I am happy to do either really.

If we put log4moz in the directory I would prefer to have a build step that puts it there to prevent bit rot.

What is the norm for Mobile in situations like this?
I am concerned because this needs to be in the correct application space.  We might need additional manifest or similar files to make it accessible.
This is one approach that we can use or as :jmaher suggests we can build our own stub. The reason why it is not available is because it is part of the services code which now has a full java implementation and doesnt require this code so its not packaged.
Comment on attachment 657296 [details] [diff] [review]
updating build.mk to let us use log4moz

Review of attachment 657296 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/build.mk
@@ +22,5 @@
>  ifdef MOZ_EXTENSIONS
>  tier_app_dirs += extensions
>  endif
>  
> +ifdef ENABLE_MARIONETTE

this should still allow the original ifdef, I am sure there is some crazy form of makefile syntax to make that work.
Attachment #657296 - Attachment is obsolete: true
Blocks: 787545
Comment on attachment 657314 [details] [diff] [review]
updated since my repo was out of date and to handle comments

This allows use to use log4moz.js with Marionette. Since this is only with Marionette it shouldnt impact the end build
Attachment #657314 - Flags: review?(ted.mielczarek)
Attachment #657314 - Flags: feedback?(mark.finkle)
Comment on attachment 657314 [details] [diff] [review]
updated since my repo was out of date and to handle comments

Seems like a sane way to make this work
Attachment #657314 - Flags: feedback?(mark.finkle) → feedback+
QA Contact: dburns
Assignee: nobody → dburns
QA Contact: dburns
Attachment #657314 - Flags: review?(ted.mielczarek) → review?(benjamin)
Attachment #657314 - Flags: review?(benjamin) → review?(mh+mozilla)
(In reply to David Burns :automatedtester from comment #8)
> Comment on attachment 657314 [details] [diff] [review]
> updated since my repo was out of date and to handle comments
> 
> This allows use to use log4moz.js with Marionette. Since this is only with
> Marionette it shouldnt impact the end build

... for now. How sure are you that marionette is not going to be enabled in end builds like it is on desktop nightlies and b2g?
That being said, is there any reason not to make log4moz.js part of the platform, under a resource://gre/ url?
Comment on attachment 657314 [details] [diff] [review]
updated since my repo was out of date and to handle comments

Resetting flag until this is figured out.
Attachment #657314 - Flags: review?(mh+mozilla)
(In reply to Mike Hommey [:glandium] from comment #11)
> That being said, is there any reason not to make log4moz.js part of the
> platform, under a resource://gre/ url?

I think that discussion should be had in bug 451283.

But, I was told to weigh in here, so I will.

log4moz by itself is nice. But, it's far from perfect. If you are using log4moz, you are ultimately going to need to hook up plumbing. You'll want a integration with the Error Console, preferences to control logging levels, saving log files to disk, pruning old logs from disk, rotation of log files, forwarding logs to remote debuggers, etc. This is all missing from log4moz today. This means people like Sync and AITC come around and re-implement this functionality as one-offs.

As part of moving log4moz to the core platform, I would like to see a core logging service be introduced with it. We would have a unified logging bus under the hood that different features/subsystems could feed into. That bus/service would handle preferences to control settings, saving logs to disk, forwarding events, etc. As a consumer, you would just need to obtain a named logger and write data. If you are introducing a new subsystem, maybe you need to perform one-time registration (via prefs?) to let the bus know how it should handle events.

The central logging service also has a nice advantage: unified I/O handling. This is very difficult to get right. You can't have synchronous writes to disk for every log message because it's inefficient for the I/O subsystem and is blocking I/O. You don't want to have a synchronous API for dropping a log message from the application because that would result in horrendous JS with excessive closures and callbacks. A central logging service could allow messages to be passed to it with a synchronous API call which then forwarded messages to appropriate async APIs to do aggregation, I/O, etc. Complexity abstracted.

Anyway, log4moz currently exceeds at being an API for applications to send individual log messages somewhere. There are backend APIs in log4moz for doing something with these messages (appenders), but they are fragile and easy to use incorrectly. For that reason, I'm advocating for a central logging service as part of the platform. Subsystems inevitably reinvent this wheel, so we might as well provide it to everyone. And, who knows, maybe it leads to better introspection of Firefox since a unified messaging bus with interleaved events from all subsystems is pretty damn handy.
Note that this crosses the path of bug 602467. Although the intent of that bug was for C++ code, a single facility for all logging would surely be helpful.
Could we spin off a separate bug for how this should be dealt with or fix this in bug 451283 or bug 602467. Once things have been moved there will probably be code updates anyway and I can update my code reliant on this there.
Comment on attachment 657314 [details] [diff] [review]
updated since my repo was out of date and to handle comments

Since there hasnt been any visible discussion of this I am resetting the review flag. We can always spin off a separate bug or fix the log4moz to toolkit bug.
Attachment #657314 - Flags: review?(mh+mozilla)
Comment on attachment 657314 [details] [diff] [review]
updated since my repo was out of date and to handle comments

Review of attachment 657314 [details] [diff] [review]:
-----------------------------------------------------------------

::: mobile/android/build.mk
@@ +22,5 @@
>  ifdef MOZ_EXTENSIONS
>  tier_app_dirs += extensions
>  endif
>  
> +ifdef ENABLE_MARIONETTE

Please add a condition on the build being for fennec.
Attachment #657314 - Flags: review?(mh+mozilla) → feedback+
closing this in favour of work being done in bug 451283
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
Blocks: 1294427
No longer blocks: 1294427
Product: Testing → Remote Protocol
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: