Allen Williams

Ranch Hand
+ Follow
since Sep 04, 2006
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Allen Williams

Thanks again! Now that I'm back on this app, you'll see plenty of me!
12 years ago
Yeah, I know, I know. I will not argue with one word you wrote, and in fact thank you for taking the time to do so. I started this app is several years ago, set it aside because I got involved in a circuit design/embedded software project, and just picked it back up. The problem is that I've the custom log calls all through it. When I get it really finished (with kludgy logging), I'm thinking I may be able to go back and redo the logging evolutionarily by first changing my logging class implementation to use standard logging, then gradually replacing all the call throughout the app as I maintain it. I know- right now it's an example of really bad form:-(

Thanks again for the help!
12 years ago
Well, I'm not too sure what I did, but now I'm getting the System.err.println messages in the aforementioned stderr.log. After I pointed (in the init.d script) command line arguments (outfile=... and errfile=...) I started getting messages in this file, but none of mine. I looked, and somewhere along the line, I made my <Context> tag this:


<Context path="" docBase="" swallowOutput="true" debug="5"
reloadable="true"
antiResourceLocking="false" privileged="false">


As I'm sure you gurus know, the "debug=" attribute is not a documented attribute for the Context tag (I saw it somewhere, and put it in). Tomcat never did complain, but I removed it, making the Context tag this:


<Context path="" docBase="" swallowOutput="true" reloadable="true"
antiResourceLocking="false" privileged="false">


And now everything works. Not sure what happened. I did not start out with that in the context tag. I'm wondering if maybe I had an OS glitch?

Thanks for all the help!!

anw
12 years ago
I guess it is a tomcat issue, instead of my servlet. Sorry about that; originally, I thought it was an error in my servlet.

In my init.d startup script, I discovered this:


$DAEMON -user "$TOMCAT6_USER" -cp "$JSVC_CLASSPATH" \
-outfile SYSLOG -errfile SYSLOG \
-pidfile "$CATALINA_PID" $JAVA_OPTS "$BOOTSTRAP_CLASS"


(Note the SYSLOG entries) which I changed to this:


$DAEMON -user "$TOMCAT6_USER" -cp "$JSVC_CLASSPATH" \
-outfile /var/log/tomcat6/stdout.log -errfile /var/log/tomcat6/stderr.log \
-pidfile "$CATALINA_PID" $JAVA_OPTS "$BOOTSTRAP_CLASS"


so now I have an stderr and stdout in my log directory, but it still doesn't have any of my System.err.println's in it
12 years ago
Thanks for taking a stab at this.

Not Windows; Debian Linux 2.6.26, i686

Vanilla Tomcat 6 distribution from Debian apt package.
12 years ago
Tomcat 6.0, despite having this in my code:

I can't get anything to display in any of the log files. Here is my logging.properties:


# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Logging levels: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST or ALL

handlers = 1catalina.org.apache.juli.FileHandler, 2localhost.org.apache.juli.FileHandler, 3info-dev.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler

.handlers = 1catalina.org.apache.juli.FileHandler, java.util.logging.ConsoleHandler
.level=WARNING

############################################################
# Handler specific properties.
# Describes specific configuration info for Handlers.
############################################################

1catalina.org.apache.juli.FileHandler.level = WARNING
1catalina.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
1catalina.org.apache.juli.FileHandler.prefix = catalina.

2localhost.org.apache.juli.FileHandler.level = WARNING
2localhost.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
2localhost.org.apache.juli.FileHandler.prefix = localhost.

3info-dev.org.apache.juli.FileHandler.level = ALL
3info-dev.org.apache.juli.FileHandler.directory = ${catalina.base}/logs
3info-dev.org.apache.juli.FileHandler.prefix = info-dev.

java.util.logging.ConsoleHandler.level = ALL
java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter

############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler

org.apache.catalina.core.ContainerBase.[Catalina].[info-dev].[/infoisland].level = ALL
org.apache.catalina.core.ContainerBase.[Catalina].[info-dev].[/infoisland].handlers = 3info-dev.org.apache.juli.FileHandler
# org.apache.catalina.core.ContainerBase.[Catalina].[info-dev].[/infoisland].handlers = java.util.logging.ConsoleHandler

utils.AppInitializer.level = ALL

# For example, set the com.xyz.foo logger to only log SEVERE
# messages:
#org.apache.catalina.startup.ContextConfig.level = FINE
#org.apache.catalina.startup.HostConfig.level = FINE
#org.apache.catalina.session.ManagerBase.level = FINE
#org.apache.catalina.core.AprLifecycleListener.level=FINE


and here are the log files that are produced-

catalina.xxx.log:


Aug 8, 2009 7:06:40 PM org.apache.catalina.users.MemoryUserDatabase save
WARNING: User database is not persistable - no write permissions on directory


info-dev.log:


Aug 8, 2009 7:06:41 PM org.apache.catalina.core.StandardContext listenerStart
FINE: Sending application start events
Aug 8, 2009 7:06:41 PM org.apache.catalina.core.StandardContext filterStart
FINE: Starting filters


localhost.log:


<null>, i. e., nothing in log


ANY ideas why my console AND my log file are being sent to a black hole? BTW, I have also set and unset swallowOutput="true" multiple times in my <Context> tag.
12 years ago
New data point: when I set the handler in my logging.properties file thusly,

I get 0 bytes in the info-dev log (which used to have the aforementioned expception in it). Where is my console going?
12 years ago
Any more suggestions? I still haven't gotten this to work.
12 years ago
Replacing the guts of the write() method may be a way to go, but it is frustrating not to be able to figure out why the basic system calls won't work. I know it must be something trivial I'm missing. The main problem with "doing logging write" (pun intended) is that the whole web app uses it throughout.
12 years ago
P. S.

I've also tried adding to the <Context> tag.
12 years ago

David Newton wrote:I'd suspect the default config is different.


Right. I've done a little more rooting around, and changed my logging.properties to this (info-dev is the hostname of the development computer I'm using):

So now I've got a separate info-dev log, which I guess is a good thing, but all it has in it is the prior-noted exceptions; it still doesn't have the println output. Is there any were else it could be configured, or could log files be stored elsewhere? This must be something trivial I'm missing. Does anything need to be configured in the server.xml or within the <Context> tags?


[ Why are you rolling your own logging? Log4J and/or Commons Logging is a snap to use.


I know, I know...but I just got the brand new version of tomcat up and running and went back to this code after two years, and this was the first thing that broke. I do feel like I need to understand what's going on, even if I redo the logging to be more standard. Is commons logging the same thing as java.util.logging?

Thanks for the help!
12 years ago
I know I'm bound to be doing something stupid. This is code I haven't worked on in about two years, then on tomcat 5, and I set up a brand new tomcat6 server and began to work on it again.

Note the log.write's in here, and the initDB, initAppInfo, etc.:

Here is log.write:

And, here's catalina*.log:


Aug 4, 2009 9:03:34 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Aug 4, 2009 9:03:34 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 753 ms
Aug 4, 2009 9:03:34 PM org.apache.catalina.users.MemoryUserDatabase save
WARNING: User database is not persistable - no write permissions on directory
Aug 4, 2009 9:03:34 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Aug 4, 2009 9:03:34 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.18
Aug 4, 2009 9:03:35 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class utils
.AppInitializer
java.lang.NullPointerException
at dbMgr.dbUtils.dbGetMaxSessions(dbUtils.java:99)
at utils.AppInitializer.initAppInfo(AppInitializer.java:92)
at utils.AppInitializer.contextInitialized(AppInitializer.java:38)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:
3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:7
91)
at org.apache.catalina.core.ContainerBase.access$000(ContainerBase.java:123)
at org.apache.catalina.core.ContainerBase$PrivilegedAddChild.run(ContainerBase.
java:145)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:769)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553
)


You can see that it got an exception in initAppInfo (third line into exception print), but none of the prior System.err.println or System.out.println's printed.

TIA,
anw
12 years ago
OK, I think I found the problem. I fixed it in the stripped down version, but need to put everything else in and see if it still works. On the W3C.org site, I found the following statement:


17.13.2 Successful controls

A successful control is "valid" for submission. Every successful control has its control name paired with its current value as part of the submitted form data set. A successful control must be defined within a FORM element and must have a control name.(Emphasis mine)


If you'll notice in the original html I posted, there's no name attribute. When I added that, I got the file section in the request.

Thanks for the help,
Allen
14 years ago
OK, I stripped out everything except the normal, plain file upload input tag, and tried it with both Iceweasel & "canonical" Firefox, and still don't get the file. The content of the request is reduced to:


The body of the request follows:

Oct 29 16:36:30: -----------------------------20014300982800--


Nothing.

Any thoughts?
14 years ago
I didn't get to my office today to try IE or the "canonical" Windows version of Firefox, but will do that tomorrow. Meantime, I'm doing a lot of strange stuff to try to "pretty up" the file upload widget on the page. As you are probably aware, for "security reasons" (the ultimate excuse for making everything a pain in the a** :rolleyes , the file upload input tag is pretty much uncustomizable. Plus, I attach a bunch of other stuff I need to know about to invisible form inputs, so I'm going to try to deconstruct that stuff to the point I only have the file input, then, if that works, add stuff back in until it breaks, and figure it out that way.

Thanks, and I'll post my results.
14 years ago