Can I turn logging off in Restlet framework? - restlet

I have some code that is using the Restlet framework. It is writing an ERROR into my log4j log file:
2012-05-30 12:16:42,169 3278917 ERROR [STDERR] (Thread-97:) 30-May-2012 12:16:42 org.restlet.engine.http.connector.HttpClientHelper start
INFO: Starting the default HTTP client
Is there any way I can turn this logging off? I see there is a Client.getLogger(), but I can't see a way to use that to turn logging off.

You can rely on regular Java logging configuration (java.util.logging). Restlet Framework provides a simple way to adjust those properties, programmatically. Call for example:
org.restlet.engine.Engine.setLogLevel(Level.OFF);

Hi it maybe a little late but for me the following code did it:
ClientResource resource = new ClientResource();
resource.getLogger().setLevel(Level.WARNING); //<-- important
I left out the resource configuration and exectution because they are not important;-)

Related

H2-console in r2dbc-h2 driver

I am using R2DBC-H2 driver, and my UR.L is spring.r2dbc.url=r2dbc:h2:mem:///customer
Using this configuration, SpringBoot starts fine, however, I can not access the h2-console.
Does anybody know why, and how I can fix it?
If I understand the source code of H2ConsoleAutoConfiguration correctly, the h2 console auto configuration from spring boot does not work in a reactive environment.
...
#ConditionalOnWebApplication(type = Type.SERVLET)
...
public class H2ConsoleAutoConfiguration {
You can confirm this by yourself by changing the type of your web application to SERVLET (for example, by adding spring-boot-starter-web as a dependency) which will activate the route to the h2 console (if enabled in the application properties). The h2-console route endpoint will start working again.
As the whole code seems very servlet-specific, I don't know how to properly fix this problem.
H2 Console depends on traditional Jdbc drivers, not compatible with Spring WebFlux stack.
If you are developing a WebFlux application, you can use H2 as a standalone database, ane use H2 Console freely.
Following the official Getting Started guide to start H2 Database and H2 Console.
Set your spring.r2dbc.url to the database url you are running in the first step.
NOTE: Do not use a Memory DB here.

Biztalk WCF won't show up custom behavior

I created a custom behavior for BizTalk in order to connect to an API with Oauth authentication.
I did these steps :
I added it to the GAC
Added the lines in machine.config (both)
restarted IIS, Biztalk admin console
I can even see it with SvcConfigEditor.
However when I create a WCF-Custom and try to add the Behavior, it is actually nowhere in the pick list.
Any idea please?
So....yes, it does work, but WCF being...well...WCF...
You do have to restart the machine. I don't recall ever getting this to work without doing so.
Then just keep checking the registration against other examples. Eventually, you'll get it.
Import your behaviour extension in Adapter Handler level.
In your biztalk administration console, go to Adapters -> Select the adapter and click the Handler Properties and import your extension.
Hope this helps.

Spring Config Client - ConfigClientWatch

I am looking at the class ConfigClientWatch in the package package org.springframework.cloud.config.client;
I was expecting that I could use this to poll the server periodically to see if the config had changed and then execute an refresh.
I am not able to get this to work? How does the value
String newState = this.environment.getProperty("config.client.state");
Get updated.
I have not been able to find any documentation on this.
Thanks in Advance
Raghu
Unfortunately, this property is only used by Vault backend. Anyway, there is a thread in the Spring Config's GitHub proposing changes to support other backends such as Git.
If you are using Git-backed configurations, this solution may work for you:
https://github.com/spring-cloud/spring-cloud-config/issues/1378#issuecomment-492073851
Please, upvote the GitHub thread so this feature gets accepted.

"Multiple serializers are not supported" configuration error in NServiceBus 4.0.4 during unit testing

I am trying to unit test message handlers for NServiceBus 4.0.4. The bus is configured to use JSON serializer in the application using the Configure.Serialization.Json(); method call.
Whenever I call the Test.Initialize() method from the unit tests assembly I get the following exception: System.Configuration.ConfigurationErrorsException : Multiple serializers are not supported. Please make sure to only enable one
I tried calling Configure.Serialization.Json() and Serializers.SetDefault<JsonSerialization>() before calling the Test.Initialize() method without any success.
Does anyone know what am I doing wrong? All examples I see on the internet do not mention any Configure calls.
This issue has been reported previously here and looks like it will be fixed in the next NServiceBus build (both 4.0.5 and 4.1.0)
A workaround is to explicitly disable the xml serializer when enabling the json one.
Configure.Serialization.Json();
Feature.Disable<XmlSerialization>(); // hack to make NSB unit tests work

How to address JNDI configuration when using mvn scala:console

I'm troubleshooting a Mapper problem and I'm running into an issue trying to use a Mapper class inside of the Scala/Lift console. Our MetaMappers have their datasource configured through a ConnectionIdentifier that points to a JDBC datasource configured in JNDI. This works great when bootstrapping through Jetty.
When loading the console and running (new bootstrap.liftweb.Boot).boot to initialize, Schemifier.schemify fails JNDI configuration is not available.
scala> (new bootstrap.liftweb.Boot).boot
java.lang.NullPointerException: Looking for Connection Identifier ConnectionIdentifier(jdbc/svcHub) but failed to find either a JNDI data source with the name jdbc/svcHub or a lift connection manager with the correct name
at net.liftweb.mapper.DB$$anonfun$7$$anonfun$apply$12.apply(DB.scala:141)
at net.liftweb.mapper.DB$$anonfun$7$$anonfun$apply$12.apply(DB.scala:141)
at net.liftweb.common.EmptyBox.openOr(Box.scala:465)
at net.liftweb.mapper.DB$$anonfun$7.apply(DB.scala:140)
at net.liftweb.mapper.DB$$anonfun$7.apply(DB.scala:140)
at net.liftweb.common.EmptyBox.openOr(Box.scala:465)
at net.liftweb.mapper.DB$.newConnection(DB.scala:134)
at net.liftweb.mapper.DB$.getConnection(DB.scala:230)
at net.liftweb.mapper.DB$.use(DB.scala:581)
at net.liftweb.mapper.Schemifier$.schemify(Sche...
Essentially, I'd like to have full MetaMapper functionality from within the console. My question is: What's the best way to bootstrap a Lift app from the console such that the JNDI-based dependencies can also be fulfilled outside of a JNDI-capable web container?
Under a application server it's likely that the server will provide a JNDI context for you. In a standalone application you must provide a JNDI Context your self. For that you can use a javax.naming.InitialContext.
There is a nice example using Apache's DBCP here: http://commons.apache.org/dbcp/guide/jndi-howto.html. Of course, will you have to fix the Datasource objects to the implementation you are using.
This will be enough (not very elegant, though) for simple JNDI usage.