golang 读取日志文件_RTFLF-读取删除日志文件

本文讲述了在解决一个404错误时,忽视了基础的调试步骤——查看日志文件,最终导致浪费时间。作者的朋友通过简单地查看LogFiles找到了问题所在,即微软的URLScan阻止了含有.svc的请求。这个故事提醒我们,在遇到问题时,首先要考虑基础的调试手段,如检查日志。
摘要由CSDN通过智能技术生成
golang 读取日志文件

golang 读取日志文件

A buddy of mine and I had a nice slap in the face yesterday. I was helping him deploy an ADO.NET Data Service to a large company's staging server  and we were seeing REALLY odd behavior.

我的一个伙伴,昨天我脸巴掌。 我当时正在帮助他将ADO.NET数据服务部署到一家大型公司的登台服务器上,我们看到的确是奇怪的行为。

We'd request something like /myservice.svc and get a 404. But we could request /myservice.svc/Stuff or /myservice.svc/?metadata.

我们将请求类似/myservice.svc的代码并获得404。但是我们可以请求/myservice.svc/Stuff或/myservice.svc/?metadata。

We settled in to debug this. We thought we were "getting down to basics." You know, you've done this. The conversation goes something like:

我们安顿下来进行调试。 我们以为自己“基本”。 你知道的,你已经做到了。 对话过程如下:

"Ok, people, what's the definition of insanity? Trying the same thing and expecting a different result."

“好吧,人们,精神错乱的定义是什么?尝试相同的事情并期待不同的结果。”

"Right...let's challenge all our assumptions. Let's start from scratch. Can get Hello World working?"

“正确……让我们挑战所有假设。让我们从头开始。可以让Hello World正常工作吗?”

"What's the ACLs on that file? Is the .svc extension registered? Are we sure we have the right version of .NET?"

“该文件上的ACL是什么?是否已注册.svc扩展名?我们确定我们具有正确的.NET版本吗?”

We were both tired and we wasted a couple of hours basically dicking around, hitting Refresh and hoping for another solution. I wanted to plugin procexp and filemon and get down to some serious CSI: IIS-type debugging, but here's the rub: We didn't have access to the machine. Only "large company's" guys were allow to touch anything. We could make suggestions, watch a SharedView session, but the human latency of the whole process was slowing us by a factor of at least five.

我们俩都很累,我们浪费了几个小时,基本上都是在闲逛,然后点击“刷新”并希望找到其他解决方案。 我想插入procexp和filemon并进行一些严肃的CSI:IIS类型的调试,但这很麻烦:我们无权访问该机器。 只有“大公司”的家伙才可以触摸任何东西。 我们可以提出建议,观看SharedView会话,但是整个过程的人工延迟至少使我们慢了五倍。

But I can't blame it all on the process. In retrospect, it was my fault. I'm a good debugger. I know this and I'm happy to say it. However, I can recognize a ninja when I see one. Well, if you can see the ninja, maybe they aren't a ninja, but still. I reached out to a real debugging ninja. What did he do that I was missing?

但是我不能将所有责任都归咎于这一过程。 回想起来,这是我的错。 我是一个很好的调试器。 我知道这一点,很高兴地说。 但是,当我看到忍者时,我就​​能认出它。 好吧,如果您能看到忍者,也许他们不是忍者,但仍然如此。 我接触了一个真正的调试忍者。 我错过了他做了什么?

I ignored a basic tenet of debugging. It wasn't that I didn't RTFM. I didn't RTFLF.

我忽略了调试的基本原则。 不是我没有RTFM 。 我没有RTFLF

My debugger-ninja-friend started out by simply asking us to Start|Run and type "LogFiles."

我的debugger-ninja-friend刚开始时,只是要求我们启动|运行并键入“ LogFiles”。

At this point I realized that this process was going to make me look and feel like an idiot. My internal lights went on and I realized my buddy and I hadn't bothered to check any log files. We'd been treating IIS like it was a black box. It's not. It logs the hell out of everything that goes in and out if you want it to.

在这一点上,我意识到这个过程会让我看起来像个白痴。 我的内部灯一直亮着,我意识到我的伙伴,而且我没有费心检查任何日志文件。 我们一直把IIS当作黑匣子一样对待。 不是。 如果需要,它会将所有进出的地狱注销。

We were trying to debug a 404 on this .svc. We opened the log in Notepad, went to the bottom, searched up for ".svc" and there it was:

我们正在尝试在此.svc上调试404。 我们在记事本中打开日志,转到底部,搜索“ .svc”,它是:

This Page was blocked by Microsofts URL Scan 3.0 Reason=Dot-in-path-detected

此页面被Microsoft的URL扫描3.0阻止原因=检测到路径

You could have knocked me over with a feather. I've said myself, UrlScan is step 0. If you're debugging a weird 404, UrlScan is the first and most obvious place to look and it was all there, in the log files. You remember, the log files I never looked at. ;)

你可能用羽毛把我打倒了。 我自己说过, UrlScan是第0步。如果您要调试一个奇怪的404,则UrlScan是查找的第一个也是最明显的地方,并且所有这些都在日志文件中。 您还记得我从未看过的日志文件。 ;)

Did my ninja friend know or care? No, because he RTFLF. A painful reminder to me as I wasted a bit of a ninja's time. Everyone knows, don't piss off a ninja. He was cool about it though.

我的忍者朋友知道或关心吗? 不,因为他是RTFLF。 我浪费了忍者的时间,这让我很痛苦。 每个人都知道,不要生气忍者。 他对此很酷。

Today's Lesson: Whatever it was, it was probably logged. Try there first.

今日课程:无论是什么,它都可能被记录下来。 首先尝试。

* Pic from Dr. McNinja.

*图片来自McNinja博士

翻译自: https://www.hanselman.com/blog/rtflf-read-the-expletive-log-file

golang 读取日志文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值