Comments (5)
Currently the logging is only for debugging purpose.
You can actually simply override print() in PrintStream, and redirect the output to slf4j, then you can use whichever framework you want.
from facebook-java-business-sdk.
Currently the logging is only for debugging purpose.
Isn't that what most logging is for?
You can actually simply override print() in PrintStream, and redirect the output to slf4j, then you can use whichever framework you want.
Okay, but that's the whole point of slf4j; it's simply a facade which lets the consumer supply the logging framework of her choice.
Using slf4j has other advantages:
- You don't need a separate debug flag.
- The consumer can have finer grained control over what to log and when. For example, while debugging an issue, one might log everything, but in steady state just log errors to avoid polluting the logs.
- String formatting support in slf4j and similar logging frameworks avoid allocating unnecessary objects when the message is simply discarded. Here is an example. Granted, it may not be significant in most cases, but some people like to avoid unnecessary garbage.
- Customization of the message format. The consumer can choose to log timestamps, and other auxiliary information.
- No need for special configuration (like your suggestion to create a PrintStream class). A consumer's other dependencies will typically have their logging configured in one place.
Maybe you think it's overkill, or don't want to add the dependency? I can already see a need for separate log levels, since as is there is only a single flag, so you either get a huge amount of information, or none at all. Additionally, as the library grows, so will the need to log different kinds of information (exceptions, warnings, etc). And regarding adding a dependency, I am going to guess that the vast majority of consumers already depend on slf4j, either directly or transitively. If this is a serious impediment, then I think even using java.util.logging would be a better option.
To be clear, I'm not asking anyone to do this work. I'll gladly contribute the PR for this (and any other issues I've opened). First I just want to figure out whether it will be accepted or not :-)
from facebook-java-business-sdk.
Hi kilink,
I actually agree that the logging needs improvement. Current logging is only for SDK debugging to check if the HTTP request is assembled and sent correctly, so it's not well structured. I think many people do want to log and archive all the requests they send in a better structure (maybe a JSON string like {"request": {...}, "response": {...}} ?), which is not supported right now but would be great to have, and in this case slf4j will be a good choice. I think slf4j is lightweight so I'm not worried about dependency.
This project is open-source and we're happy to see people contribute to it. You're more than welcome to make contributions :)
Thanks!
from facebook-java-business-sdk.
+1
from facebook-java-business-sdk.
It seems like this issue has been open for more than a few months now. We have made many changes in the SDK since then, including releasing a new version. If you can repro your specific issue with the latest version of the SDK, please create a new issue or comment here with further details.
from facebook-java-business-sdk.
Related Issues (20)
- adSet/reach-estimate does not exist in SDK HOT 1
- AdsInsights gives json parse error when fetching breakdown link_url_asset HOT 5
- Application does not have permission for this action, Please retry this action in a few minutes
- Futures.addCallback is deprecated HOT 3
- Create adset failed
- Create adset failed
- Add `depends_on` support for Batch Request HOT 1
- Async Insights - Exception while parsing image_asset field HOT 3
- lead fetch fail
- Missing `targeting_automation` field in Targeting HOT 2
- AdCreative with `asset_feed_spec` is not creating the Ad with Website destination HOT 1
- not compatible with latest guava HOT 1
- Why the `VALUE_MAXIMUM ` has been replaced with `VALUE_LIFETIME` in AdsInsights.EnumDatePreset in v19.0.1? HOT 5
- There is no Summary attribute on Insights and Campaigns
- When can we expect v20 release for java sdk HOT 1
- https://graph.facebook.com/ahmedvedohyperdjtracks/get
- Facebook Java Business SDK v20 jar is not available
- ArrayIndexOutOfBoundsException on invalid postal code
- Not able to get all conversations from instagram
- Accessing Business User Insights for Multiple Users Using the Instagram API
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-java-business-sdk.