Logging in Eco.MVC.EcoController - mdriven

In my MDriven MVC application I'm logging Trace messages into a log file. It seems that the class Eco.MVC.EcoController uses the Trace to log following events:
EcoController.EnsureEcoSpace: HomeController
EcoController.EnsureEcoSpace: CreateEcoSpace
EcoController.ReleaseEcoSpace: Disposing EcoSpace
OnResultExecuted (EcoController out of scope).
Is it possible to switch this logging off?

Oops - no they were not optional. Checking in fix for this now.
They will be default off and turned on with:
EcoTraceCategories.WebDebugPrint = true;

Related

Camel DefaultShutdownStrategy logging full url

I'm having an issue where I cannot prevent the shutdown strategy in camel from logging my full URL. This is a problem because the URL has a password in it.
Neither of the .logMask() calls suppress this log line. How can I go about preventing this from being logged?
context.addRoutes(new RouteBuilder() {
#Override
public void configure() {
from(uriString)
.logMask()
.process(exchange -> {
Message in = exchange.getIn();
// Doing some business logic here
})
.toD("direct:someOtherRoute")
.logMask();
}
});
The line being logged:
kafka://MY-TOPIC-NAME?saslJaasConfig=passwordThatShouldNotBeLogged&otherParams...
Edit: The full url is being logged both on startup and shutdown.
Okay this information is logged by Camel. But we have fixed this for next releases (2.25.0 onwards, and the 3.x branches).
For your current version, you cannot prevent this. However you can configure the logging level for that shutdown class to be WARN level.
You can also patch your Camel version yourself, this is the commit
https://github.com/apache/camel/commit/f60e4a73935bea211eec38823698d73bd1d0bd62
If your sensitive endpoint parameters are for SSL configuration, you can register the SSL configuration in the Camel Context and only reference it in the endpoint parameters.
kafka://MY-TOPIC-NAME?sslContextParameters=#ssl
See the Camel-Kafka Docs (section SSL Configuration) for details.

Swift Unified Logging

I was searching for some information on how to do proper logging in swift. I found Unified Logging: https://developer.apple.com/documentation/os/logging.
When trying it, I couldn't figure out how I can see the logs for only my defined Subsystem and the Category. Is there a way in the console oder the system log of the ios simulator to have only the application related logs? I couldn't see the app logs neither in the console nor in the simulator's system logs.
Here is my code:
let customLogger = OSLog(subsystem: "com.myapp", category: "CustomLogs")
os_log("Test log message.", log: customLogger, type: .debug)
In case you still looking for an answer.

JavaMail crashes after build/deploy on Glassfish 4

My current project includes using of a JavaMail for confirming an user email. The problem I have is that, using eclipse, every time I build & deploy my web application on the local Glassfish server the JavaMail crashes with the following exception:
Severe: java.lang.SecurityException: Access to default session denied
at javax.mail.Session.getDefaultInstance(Session.java:333)
at utils.MailService.sendEmailSSL(MailService.java:58)
And here the code snipped where I'm obtaining the session and which is throwing the above exception:
Session session = Session.getDefaultInstance(
props,
new javax.mail.Authenticator(){
protected PasswordAuthentication getPasswordAuthentication() {
return new PasswordAuthentication(usr, pwd);
}
});
The workaround I've found so far is restarting Glassfish and after that JavaMail functions properly again. The problem is it is very annoying and time consuming doing a restart even after the smallest change in my code.
My question: Is there a possibility to reset only the JavaMail service and bind this with the build event?
Off course any other suggestions are welcome too :)
If you can avoid using Session.getDefaultInstance. Use Session.getInstance and fix some of the common mistakes.

Log after actor system has been shutdown

I am using log method from with ActorLogging to make logs. I would like to make a few logs after the system is shut down, but that is not working, as I would assume it uses system for logging. What I would like to do looks like that:
logger.info("Shutting down actor system.")
context.system.shutdown()
context.system.registerOnTermination {
logger.info("Actor System terminated, stopping loggers and exiting.")
loggerContext.stop()
}
Are there any workarounds to this problem?
Thanks!
You can use just slf4j (backed for instance by logback) directly as described here.

Play Framework 2 -- custom loggers in production?

I have a class with a custom logger. Here's a trivial example:
package models
import play.Logger
object AModel {
val log = Logger.of("amodel")
def aMethod() {
if (! log.isInfoEnabled) log.error("Can't log info...")
log.info("Logging aMethod in AModel")
}
}
and then we'll enable this logger in application.conf:
logger.amodel=DEBUG
and in development (Play console, use run) this logger does indeed log. But in production, once we hit the message
[info] play - Application started (Prod)
loggers defined like the above logger fail to log any further and instead we go through the error branch. It seems their log level has been changed to ERROR.
Is there anyway to correct this undesirable state of affairs? Is there special configuration for production logs?
edit
Play's handling of logs in production is a source of difficulty to more than a few people... https://github.com/playframework/playframework/issues/1186
For some reason it ships its own logger.xml which overrides application.conf.