WSO2 BAM 2.5 - Default Logger Output Event Adaptor - wso2

Which directory and file does the default logger output event adaptor write the logs to? I am not able to see the logs in the repository/logs/wso2carbon.log file? The log4j properties file in repository/conf has the default configurations and I can see the mention of wso2carbon.log there. Are there any additional configurations necessary? Please help.

It is stored in wso2carbon.log file and also log output adapter should print event logs in terminal console as well.
You can download the log file by System Logs which is located Carbon Management Console > Monitor > System Logs > Show archived logs

Related

how to Enable Debug logs in All components in WSO2 IS?

how to Enable Debug logs in All components in WSO2 IS?
I want to track code running.
Could you tell me what config I need add ?
Thanks
henry
You can turn the logs in WSO2IS by making all the logs into debug level in Log4j configurations. To do that
Go to //repository/conf directory
Open log4j2.properties file
In there you can find loggers=AUDIT_LOG, trace-messages, org-apache-coyote,... field make sure to add all the Java package names there
Change the log level in every package to 'DEBUG'. as an example
logger.org-apache.name = org.apache
logger.org-apache.level = DEBUG
logger.org-apache.additivity = false
logger.org-apache.appenderRef.CARBON_LOGFILE.ref = CARBON_LOGFILE
After that you can find that all the debug logs have being visible in the terminal.

Java Util Logging File Configuration Conundrum

My log.properties contains configuration
java.util.logging.FileHandler.formatter = java.util.logging.SimpleFormatter
java.util.logging.FileHandler.level = INFO
java.util.logging.FileHandler.pattern = logs/startup.%g.log
java.util.logging.FileHandler.limit = 10000000
java.util.logging.FileHandler.count = 3
GtfsOperatorManager.level=INFO
TripUpdate.level=FINER
VehiclePosition.level=INFO
Alert.level=INFO
where the root logger logs to a file called startup and other loggers such as TripUpdate are set up programmatically to log to their own files.
The problem is that as shown log entries only go into TripUpdate at level INFO . However if I comment out the line
#java.util.logging.FileHandler.level = INFO
then TripUpdate logs at FINER as configured but log entries then go into the startup log at FINER too rather than INFO.
What am I doing wrong, how do I get startup logging at INFO and TripUpdate logging at FINER ?
Try setting the root logger level in your config file by adding the following:
.level=INFO
All child loggers will inherit this level.
However if I comment out the line [snip] then TripUpdate logs at FINER as configured but log entries then go into the startup log at FINER too rather than INFO.
This is because the default java.util.logging.FileHandler.level is ALL.
Since your are doing programmatic configurations too you need to make sure you are keeping your logger from being garbage collected.
No logging is not done directly to startup above, rather it inherits log entries but I want to filter out everything above INFO
You have limited options there. You can use setUseParentHandlers on the loggers that you don't want to see output from. This can be done from the properties file by setting <loggername>.useParentHandlers=false. You can then attach an additional file handler to the logger that is no longer publishing records to the parent handlers.
Otherwise, you have to just write a log filter to check the logger name and level and install it on the file handler.

Python - logging requests summary stats using locust

I'm using locust
http://docs.locust.io/en/latest/index.html
to simulate a bunch of web users doing random site visits and file downloads. The logging option is set by specifying
locust ... --logfile </path/to/log/file>...
But this only logs a subset of internal events and print statements in the code, it does not log the request stats which are printed out on the console (if you use the --no-web option) or the UI (if you don't specify the --no-web option).
How can you capture the request stats in the log file?
Try setting the log level. From what I just read in the source it defaults to INFO
In your case I would type
locust ... --logfile </path/to/log/file> --loglevel DEBUG
Information from source:
help="Choose between DEBUG/INFO/WARNING/ERROR/CRITICAL. Default is INFO."
The stats you see on the console are a result of logging through the console_logger. See https://github.com/locustio/locust/blob/master/locust/log.py#L50
You can add your custom FileHandler to the console_logger and get those stats in a file.
console_logger = logging.getLogger("console_logger")
fh = logging.FileHandler(filename="stats.log")
fh.setFormatter(logging.Formatter('%(message)s'))
console_logger.addHandler(fh)

How to read file from WSO2 ESB without using poll interval

I am able to read the file from specified READFILEURI path if I can specify the poll interval.
My current requirement is to read the file from given path only when we trigger the proxy service.It should not poll the file automatically.When I click on "try this service" and send the request then only the file should read from the read file path and do processing.
TO test this I have removed the "transport.vfs.pollInterval" attribute from my proxy configuration and tested it.But file is not getting read from the path once I trigger the proxy request.
Could some one help me how to achieve this.
I guess it should work if you use the file connector.
https://docs.wso2.com/display/ESBCONNECTORS/Working+with+the+File+Connector
You should be able to create a simple proxy that get's triggered via http/https and the uses the above mentioned file connector read operation to read the file.
Unfortunately I cannot give you an exact example because we're still on an older esb version where this connector isn't available.
Hope that helps.
Regards
Martin

How to configure wso2 servers logging the same level of detail as console output in wso2carbon.log file

When we run the bin/wso2server.sh file in a terminal, we get nice verbose logging output in the same terminal which is very useful for debugging. But the output in the repository/log/wso2carbon.log file is minimal. I have checked all the other files in the repository/log/ directory and none have the same level of verbosity as the console output.
I tried settings under Home > Configure > Logging after logging in to the management console of wso2 application server. Specifically I set the settings for "Configure Log4J Appenders" for CARBON_LOGFILE to be the same as for CARBON_CONSOLE but this did not have desired effect. The web application level info and debug messages are shown on the terminal from where we started the wso2 application server but this is not shown in the wso2carbon.log file.
How do we get the same level of detail i.e. verbose output like we get in the terminal into the repository/log/wso2carbon.log file?
I tried a lot of changes via the "Home > Configure > Logging" of the WSO2 web based management console, to get the same level of detail as the console into the logfile but none had the desired effect. In fact I observed that even though I changed the Log Pattern of CARBON_LOGFILE to [%d] %5p - %x %m {%c}%n I still kept getting logs in the TID: [0] [AS] [2013-08-23 15:11:10,025] format in the repository/logs/wso2carbon.log file. There is definitely some problem with setting log file detail level and pattern via the web based management console at least on version wso2as 5.0.1
So I ended up hacking the bin/wso2server.sh file.
I changed the line
nohup bash $CARBON_HOME/bin/wso2server.sh > /dev/null 2>&1 &
under both start and restart sections to
nohup bash $CARBON_HOME/bin/wso2server.sh > $CARBON_HOME/repository/logs/wso2carbon.log 2>&1 &
Now I am getting same logs as console in the file.
I know its a hack but atleast I am able to get the detailed debug logs in a file for offline analysis.
Hope someone from wso2 looks into the issue of log level & pattern setting via the web based management console and solves it..
By default the console output and the wso2carbon.log file should be the same. I checked and both have the same output. In "Configure Log4J Appenders" see whether you have DEBUG as the Threshold for both CARBON_LOGFILE and CARBON_CONSOLE.