我的Web应用程序在Tomcat 8.0.36上运行。但是,应用程序的log4j.properties似乎没有被Tomcat选中。此文件位于
class ques(tk.Frame):
def __init__(self, parent, controller):
tk.Frame.__init__(self, parent)
self.Qn = 1
self.quizScore = 0
self.correctAnswer = '' # <-- create it at start (and use better name)
# v-- create empty labels
self.recordNum = tk.Label(self, text='')
self.recordNum.pack()
self.question = tk.Label(self, text='')
self.question.pack()
self.answer1 = tk.Label(self, text='')
self.answer1.pack()
self.answer2 = tk.Label(self, text='')
self.answer2.pack()
self.answer3 = tk.Label(self, text='')
self.answer3.pack()
self.answer4 = tk.Label(self, text='')
self.answer4.pack()
self.update_question_number() # <-- get question number
self.update_question() # <-- get new question
def update_question_number(self)
# Get question's number
query = "SELECT MAX(qnumber) FROM questions"
cursor.execute(query)
row = cursor.fetchone()
self.recordNum['text'] = row[0]
def update_question(self):
# Get new question
query = "SELECT * FROM questions WHERE qnumber=?"
cursor.execute(query, (self.Qn,))
row = cursor.fetchone()
self.question['text'] = row[0]
self.answer1['text'] = row[1]
self.answer2['text'] = row[2]
self.answer3['text'] = row[3]
self.answer4['text'] = row[4]
self.correctAnswer = row[5]
def confirmAnswer(self):
if self.enterAnswer == self.correctAnswer:
self.rightOrWrong['text'] = "Correct"
self.quizScore += 1
else:
self.rightOrWrong['text'] = "Incorrect"
if self.Qn < self.recNum:
self.Qn += 1 # <-- get new question
self.update_question() # <-- get new question
#lambda: controller.show_frame(ques) # ??? do you have to change frame ???
else:
self.rightOrWrong.['text'] = "Quiz Complete! Your score was: {}".format(self.quizScore)
和
/WEB-INF/lib
我做了很多Google,但我无法找到解决方案。我该如何解决这个问题?
如果Tomcat使用另一个而不是我的应用程序的log4j.properties,我如何找出Tomcat使用哪一个?我可以指示Tomcat使用我的吗?
我的网络应用程序使用log4j 1.2.17,我不打算更改。