you can't detect if USB debugging is connected or enabled without being a system application. however, we can talk about how to solve your problem. if you don't want your app to log on your official market release, there's a couple of acceptable ways to go about it,
conditionally log. wrap all your log messages like this,
if (DEBUG) Log.d(...);
before you build your official market APK, set DEBUG
to false in your code. a slightly nicer way of doing this is to add a wrapper method or class around android's logger. e.g., write a method like this,
void d(String msg) {
if (DEBUG) Log.d(msg);
}
use proguard. proguard is a tool that manipulates bytecode after compilation. you can use it to remove all logging from your code (among other things). there's quiet a learning curve to get going with proguard, but it's very powerful.
here's another post that gives the topic some in-depth discussion.
How do I enable/disable log levels in Android?