How to enable gRPC log with Google php client library? - google-ads-api

I need to understand how to enable logging using google ads api client library for php (https://github.com/googleads/google-ads-php/).
I need to see the raw json messages exchanged with Google for debugging purposes.
Even if I followed all the instruction and set up the logger properly I can not see anywhere the request/response json neither in stderr neither in file location.
I already looked at the documentation but I can not find any flag to enable logging. I set level to NOTICE then DEBUG but no informations are written.
I set the LOGGING configuration as per below:
[LOGGING]
; Optional logging settings.
logFilePath = "/tmp/log_google_api.log"
logLevel = "DEBUG"
I was expected to get the messages in std err, any suggests?

For debugging gRPC, you can set the environment variable for dumping gRPC logs. https://github.com/grpc/grpc/blob/master/doc/environment_variables.md
For example:
export GRPC_VERBOSITY=DEBUG
export GRPC_TRACE=http

Related

Get Current Serilog Configuration to know full write-to file path

We are trying to switch completely from log4net to Serilog. However, this part of functionality seems to be missing. What I need is to be able to get location of log-files Inside a library class. This is important for our Desktop Click-Once application because that location is different on different OSes and for different users. When user needs access to the logs we can direct him to the proper folder.
Very similar question was asked here:
Read current Serilog's configuration
But I can't believe that there is no way to get this information from Serilog. I don't need to change that configuration - just read it. In log4net we could do:
log4net.LogManager.GetAllRepositories()
and then
repository.Root.Appenders.OfType<FileAppender>
Please tell me that there is some kind back-door to the current LoggerConfiguration or if there is some alternative way to get file-path of the current File-Sink.
Serilog does not expose the list of Sinks that have been configured, so your only option at the moment would be to use Reflection if you really want to get this information from the live Serilog configuration.
You can see an example on this answer:
Unit test Serilog configuration
That said, given all you want to do is to know the path where log files are being written, that's something you can easily store at the start of the application at the moment you set up your Serilog logging pipeline.
If you configure the file path in code, you can store that information in a static property somewhere your entire app can access. If you get your folder path from the appSettings.json or App.config, you can read the information from there.
If you have environment variables in your configuration you can get the same values that Serilog gets by expanding these environment variables e.g. Environment.ExpandEnvironmentVariables("%LogPath%\\AppName.log")

Solace: How to switch off the info statements sent to std err from solace java api

currently seeing the following lines when running the solace client.
10-Feb-2016 11:14:13 com.solacesystems.jcsmp.protocol.impl.TcpClientChannel call
INFO: Connecting to host 'orig=myhost.com, host=solacehost.com, port=55555' (host 1 of 1, smfclient 4, attempt 1 of 1, this_host_attempt: 1 of 1)
Looked into JCSMPProperties class to control this but no luck.
Found the solution the solace API uses various logging libs, my project had commons-logging. Suppressing the log output was quite straight forward after knowing that using
static {
System.setProperty("org.apache.commons.logging.Log",
"org.apache.commons.logging.impl.NoOpLog");
}
The Solace Java API uses Jakarta Commons Logging to support different logging
frameworks, such as log4j or java.util.logging for the application’s logging
framework.
You will need to identify what is the exact logging framework used by your application, and adjust the log level for the Solace API.
For example, if your application is using log4j, you can edit your log4j.properties file to set the log level of the Solace API to WARN, to hide those info level logs.
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.logger.com.solacesystems.jcsmp=WARN, A1

How to send log statements over the network through CocoaLumberjack?

In the summary of CocoaLumberjack it is mentioned that "Lumberjack is Powerful", and then "Want more? Create your own loggers (it's easy) and send your log statements over the network."
So, I wonder how can we send log statements over the network through CocoaLumberjack?
Is there an existing interface to do this? Or must we do it by our own code?
Could somebody give me sample code to this?
To answer your question, there isn't anything built-in for sending logs over the network.
You can take the highroad and:
obtain the logs by creating a new logger (see how this guy created a new logger that redirects the logs to Crashlytics: https://github.com/TechSmith/CrashlyticsLumberjack)
OR
read the logs from a file logger and sending those over the network.
Use the DDFileLogger logFileManager to get the sortedLogFilePaths (list of paths to the log files). Those files are plain text and can be read like any other file.

Neo4j http.log empty

I'm trying to turn on http logging for an Enterprise 2.0 Neo4j server.
After following this documentation, and adding the following likes to neo4j-server.properties:
org.neo4j.server.http.log.enabled=true
# Logging policy file that governs how HTTP log output is presented and
# archived. Note: changing the rollover and retention policy is sensible, but
# changing the output format is less so, since it is configured to use the
# ubiquitous common log format
org.neo4j.server.http.log.config=conf/neo4j-http-logging.xml
the data/log/http.log file is still zero bytes even after restarting the server and then running a basic Ruby script that inserts nodes (upon request if needed).
I'm guessing I'm missing something completely obvious here so bear with me. Thanks.
UPDATE on 9/26/14
I'm still seeing this issue for Neo4j 2.1.2
has anyone managed to get the http logs to work?
There was a possible solution on google groups that you could touch the http.log file before starting the server, but still get an empty log file.
For the time being we might try to put a reverse proxy in to log the req and response.
I am seeing this problem in Neo4j 2.0.1. I added an issue to the Neo4j Github issue tracker in hopes of a resolution.
https://github.com/neo4j/neo4j/issues/2219

How to debug client side dart code in Dart editor without CORS

I have a server / client project, both written in dart. Now my server starts on port 1337 and when I run my client with the Run in dartium, my static files are served on port 3030 which allows me to debug my client code in the Dart editor.
The problem is that this causes CORS when using AJAX calls. I have properly setup my server to accept other origins (with Access-Control-Allow-Origin) but, for example, cookies aren't sent along.
Now I'm wondering: is there a way to serve my files with my server (running on 1337) and still have the possibility to debug the client side code in the dart editor?
My understanding is that you can debug, but the real problem is that you don't get the expected data back from the server due to missing cookies.
Standard CORS requests do not send or set any cookies by default.
In order to include cookies as a part of the request, besides setting up the server, you need to specify withCredentials property, e.g.:
HttpRequest.getString(url, withCredentials:true)...
You will also need to setup server to provide Access-Control-Allow-Credentials header.
EDIT: it seems that additional issue is that you don't want to have 2 servers, each serving different part of app.
In that case, you can configure DartEditor to launch the URL, instead of files. Go to Run > Manage Launches and add create a new Dartium or Dart2JS launch with specified URL and source directory.
Another option is to select Run > Remote Connection and attach to a running instance of browser or Dart VM.
Caveat: I haven't tried these options, so I can't tell how stable they are.

Resources